diff --git a/includes/common.inc b/includes/common.inc index a60ca32362c0089d2548693208027bf087767fdc..1702ccb32be9a5642e576fe630dc4184bba62e0e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -197,8 +197,8 @@ function form_submit($value) { } function field_get($string, $name) { - foreach (explode(";", $string) as $data) { - $entry = explode(":", $data); + foreach (explode(",", $string) as $data) { + $entry = explode("=", $data); if ($entry[0] == $name) return $entry[1]; } } @@ -206,30 +206,30 @@ function field_get($string, $name) { function field_set($string, $name, $value) { if (!$value) { // remove entry: - foreach (explode(";", $string) as $data) { - $entry = explode(":", $data); - if ($entry[0] != $name) $rval .= "$entry[0]:$entry[1];"; + foreach (explode(",", $string) as $data) { + $entry = explode("=", $data); + if ($entry[0] != $name) $rval .= "$entry[0]=$entry[1],"; } } - else if (strstr($string, "$name:")) { + else if (strstr($string, "$name=")) { // found: update exsisting entry: - foreach (explode(";", $string) as $data) { - $entry = explode(":", $data); + foreach (explode(",", $string) as $data) { + $entry = explode("=", $data); if ($entry[0] == $name) $entry[1] = $value; - $rval .= "$entry[0]:$entry[1];"; + $rval .= "$entry[0]=$entry[1],"; } } else { // not found: - $rval = "$string$name:$value;"; + $rval = "$string$name=$value,"; } return $rval; } function field_merge($a, $b) { - foreach (explode(";", $b) as $data) { - $entry = explode(":", $data); + foreach (explode(",", $b) as $data) { + $entry = explode("=", $data); $a = field_set($a, $entry[0], $entry[1]); } return $a; diff --git a/includes/node.inc b/includes/node.inc index 73b8f8c1c680c626052eaaada1f354b7cc02692d..892dde6aa3cf2a892e1e47e932b9c8b8145847ae 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[] = "<a href=\"?$entry[0]=$entry[1]\">$entry[1]</a>"; } @@ -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"); diff --git a/includes/theme.inc b/includes/theme.inc index d37b73cd9cc437c7c2b52ebac9e3e9b693a2cba3..fc34e68b321724737be6458c72655939df5ae724 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -113,9 +113,9 @@ function theme_blocks($region, $theme) { } function theme_moderation_results($theme, $node) { - foreach (explode(";", $node->users) as $vote) { + foreach (explode(",", $node->users) as $vote) { if ($vote) { - $data = explode(":", $vote); + $data = explode("=", $vote); $output .= format_username($data[0]) ." voted '$data[1]'.<BR>"; } } diff --git a/modules/account.module b/modules/account.module index 200cf7c22153751060e50d2b6ac9a3f8f04c583f..62a9cb85d9807fd54c3216cb5242429435d20a95 100644 --- a/modules/account.module +++ b/modules/account.module @@ -95,9 +95,9 @@ function account_overview($query = array()) { } function account_access($account) { - $data = explode(";", $account->access); + $data = explode(",", $account->access); foreach ($data as $array) { - $access = explode(":", $array); + $access = explode("=", $array); if ($access[0]) $output .= " $access[0]"; } return $output; diff --git a/modules/aggregator.module b/modules/aggregator.module index 8545ad000c18026e0470b175714bdce0ab36d8d8..460084c4485c181fd25d747c77d776c71b20fe27 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -17,11 +17,11 @@ function import_cron() { } } -function import_bundle($attribute, $limit = 100) { - if ($attribute) { +function import_bundle($attributes, $limit = 100) { + if ($attributes) { // compose query: - $keys = explode(",", $attribute); - foreach ($keys as $key) $where[] = "attribute LIKE '%". trim($key) ."%'"; + $keys = explode(",", $attributes); + foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'"; $result = db_query("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY timestamp DESC LIMIT $limit"); @@ -36,7 +36,7 @@ function import_bundle($attribute, $limit = 100) { function import_view_bundle() { $result = db_query("SELECT * FROM bundle ORDER BY title"); while ($bundle = db_fetch_object($result)) { - $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attribute) ."</UL>"; + $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attributes) ."</UL>"; } return $output; } @@ -46,7 +46,7 @@ function import_block() { while ($bundle = db_fetch_object($result)) { $i++; $blocks[$i][subject] = $bundle->title; - $blocks[$i][content] = import_bundle($bundle->attribute, 10); + $blocks[$i][content] = import_bundle($bundle->attributes, 10); $blocks[$i][info] = "$bundle->title bundle"; } return $blocks; @@ -81,7 +81,7 @@ function import_update($feed) { $d = eregi("<description>(.*)</description>", $item, $description); if ($l || $t || $a || $d) { - import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attribute => $feed[attribute])); + import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attributes => $feed[attributes])); } } @@ -97,14 +97,14 @@ function import_update($feed) { function import_save_item($edit) { if ($edit[iid] && $edit[title]) { - db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE iid = '$edit[iid]'"); + db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE iid = '$edit[iid]'"); } else if ($edit[iid]) { db_query("DELETE FROM item WHERE iid = '". check_input($edit[iid]) ."'"); } else { if (!db_fetch_object(db_query("SELECT iid FROM item WHERE link = '". check_input($edit[link]) ."'"))) { - db_query("INSERT INTO item (fid, title, link, author, description, attribute, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attribute]) ."', '". time() ."')"); + db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attributes]) ."', '". time() ."')"); } } } @@ -113,7 +113,7 @@ function import_form_bundle($edit = array()) { global $REQUEST_URI; $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -127,13 +127,13 @@ function import_form_bundle($edit = array()) { function import_save_bundle($edit) { if ($edit[bid] && $edit[title]) { - db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); + db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); } else if ($edit[bid]) { db_query("DELETE FROM bundle WHERE bid = '". check_input($edit[bid]) ."'"); } else { - db_query("INSERT INTO bundle (title, attribute) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attribute]) ."')"); + db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attributes]) ."')"); } module_rehash_blocks("import"); @@ -146,7 +146,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Link", "link", $edit[link], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit[refresh], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_select("Expiration time", "uncache", $edit[uncache], $period, "The time cached items should be kept. Older items will be automatically discarded. Requires crontab."); @@ -162,7 +162,7 @@ function import_form_feed($edit = array()) { function import_save_feed($edit) { if ($edit[fid] && $edit[title]) { - db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attribute = '". check_input($edit[attribute]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); + db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attributes = '". check_input($edit[attributes]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else if ($edit[fid]) { @@ -170,13 +170,13 @@ function import_save_feed($edit) { db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else { - db_query("INSERT INTO feed (title, link, attribute, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attribute]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); + db_query("INSERT INTO feed (title, link, attributes, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attributes]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); } } function import_save_attributes($edit) { foreach($edit as $iid => $value) { - db_query("UPDATE item SET attribute = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); + db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); } return "attributes has been saved"; } @@ -196,7 +196,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>items</TH><TH>last update</TH><TH>next update</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($feed = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attribute) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attributes) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -206,7 +206,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>operations</TH></TR>\n"; while ($bundle = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attribute) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attributes) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -222,7 +222,7 @@ function import_view_item() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>time</TH><TH>feed</TH><TH>item</TH></TR>\n"; while ($item = db_fetch_object($result)) { - $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attribute) ."\" SIZE=\"50\"></TD></TR>\n"; + $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attributes) ."\" SIZE=\"50\"></TD></TR>\n"; } $output .= "</TABLE>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save attributes\">\n"; diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 8545ad000c18026e0470b175714bdce0ab36d8d8..460084c4485c181fd25d747c77d776c71b20fe27 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -17,11 +17,11 @@ function import_cron() { } } -function import_bundle($attribute, $limit = 100) { - if ($attribute) { +function import_bundle($attributes, $limit = 100) { + if ($attributes) { // compose query: - $keys = explode(",", $attribute); - foreach ($keys as $key) $where[] = "attribute LIKE '%". trim($key) ."%'"; + $keys = explode(",", $attributes); + foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'"; $result = db_query("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY timestamp DESC LIMIT $limit"); @@ -36,7 +36,7 @@ function import_bundle($attribute, $limit = 100) { function import_view_bundle() { $result = db_query("SELECT * FROM bundle ORDER BY title"); while ($bundle = db_fetch_object($result)) { - $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attribute) ."</UL>"; + $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attributes) ."</UL>"; } return $output; } @@ -46,7 +46,7 @@ function import_block() { while ($bundle = db_fetch_object($result)) { $i++; $blocks[$i][subject] = $bundle->title; - $blocks[$i][content] = import_bundle($bundle->attribute, 10); + $blocks[$i][content] = import_bundle($bundle->attributes, 10); $blocks[$i][info] = "$bundle->title bundle"; } return $blocks; @@ -81,7 +81,7 @@ function import_update($feed) { $d = eregi("<description>(.*)</description>", $item, $description); if ($l || $t || $a || $d) { - import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attribute => $feed[attribute])); + import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attributes => $feed[attributes])); } } @@ -97,14 +97,14 @@ function import_update($feed) { function import_save_item($edit) { if ($edit[iid] && $edit[title]) { - db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE iid = '$edit[iid]'"); + db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE iid = '$edit[iid]'"); } else if ($edit[iid]) { db_query("DELETE FROM item WHERE iid = '". check_input($edit[iid]) ."'"); } else { if (!db_fetch_object(db_query("SELECT iid FROM item WHERE link = '". check_input($edit[link]) ."'"))) { - db_query("INSERT INTO item (fid, title, link, author, description, attribute, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attribute]) ."', '". time() ."')"); + db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attributes]) ."', '". time() ."')"); } } } @@ -113,7 +113,7 @@ function import_form_bundle($edit = array()) { global $REQUEST_URI; $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -127,13 +127,13 @@ function import_form_bundle($edit = array()) { function import_save_bundle($edit) { if ($edit[bid] && $edit[title]) { - db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); + db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); } else if ($edit[bid]) { db_query("DELETE FROM bundle WHERE bid = '". check_input($edit[bid]) ."'"); } else { - db_query("INSERT INTO bundle (title, attribute) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attribute]) ."')"); + db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attributes]) ."')"); } module_rehash_blocks("import"); @@ -146,7 +146,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Link", "link", $edit[link], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit[refresh], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_select("Expiration time", "uncache", $edit[uncache], $period, "The time cached items should be kept. Older items will be automatically discarded. Requires crontab."); @@ -162,7 +162,7 @@ function import_form_feed($edit = array()) { function import_save_feed($edit) { if ($edit[fid] && $edit[title]) { - db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attribute = '". check_input($edit[attribute]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); + db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attributes = '". check_input($edit[attributes]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else if ($edit[fid]) { @@ -170,13 +170,13 @@ function import_save_feed($edit) { db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else { - db_query("INSERT INTO feed (title, link, attribute, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attribute]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); + db_query("INSERT INTO feed (title, link, attributes, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attributes]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); } } function import_save_attributes($edit) { foreach($edit as $iid => $value) { - db_query("UPDATE item SET attribute = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); + db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); } return "attributes has been saved"; } @@ -196,7 +196,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>items</TH><TH>last update</TH><TH>next update</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($feed = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attribute) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attributes) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -206,7 +206,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>operations</TH></TR>\n"; while ($bundle = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attribute) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attributes) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -222,7 +222,7 @@ function import_view_item() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>time</TH><TH>feed</TH><TH>item</TH></TR>\n"; while ($item = db_fetch_object($result)) { - $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attribute) ."\" SIZE=\"50\"></TD></TR>\n"; + $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attributes) ."\" SIZE=\"50\"></TD></TR>\n"; } $output .= "</TABLE>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save attributes\">\n"; diff --git a/modules/import.module b/modules/import.module index 8545ad000c18026e0470b175714bdce0ab36d8d8..460084c4485c181fd25d747c77d776c71b20fe27 100644 --- a/modules/import.module +++ b/modules/import.module @@ -17,11 +17,11 @@ function import_cron() { } } -function import_bundle($attribute, $limit = 100) { - if ($attribute) { +function import_bundle($attributes, $limit = 100) { + if ($attributes) { // compose query: - $keys = explode(",", $attribute); - foreach ($keys as $key) $where[] = "attribute LIKE '%". trim($key) ."%'"; + $keys = explode(",", $attributes); + foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'"; $result = db_query("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY timestamp DESC LIMIT $limit"); @@ -36,7 +36,7 @@ function import_bundle($attribute, $limit = 100) { function import_view_bundle() { $result = db_query("SELECT * FROM bundle ORDER BY title"); while ($bundle = db_fetch_object($result)) { - $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attribute) ."</UL>"; + $output .= "<B>$bundle->title</B><UL>". import_bundle($bundle->attributes) ."</UL>"; } return $output; } @@ -46,7 +46,7 @@ function import_block() { while ($bundle = db_fetch_object($result)) { $i++; $blocks[$i][subject] = $bundle->title; - $blocks[$i][content] = import_bundle($bundle->attribute, 10); + $blocks[$i][content] = import_bundle($bundle->attributes, 10); $blocks[$i][info] = "$bundle->title bundle"; } return $blocks; @@ -81,7 +81,7 @@ function import_update($feed) { $d = eregi("<description>(.*)</description>", $item, $description); if ($l || $t || $a || $d) { - import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attribute => $feed[attribute])); + import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attributes => $feed[attributes])); } } @@ -97,14 +97,14 @@ function import_update($feed) { function import_save_item($edit) { if ($edit[iid] && $edit[title]) { - db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE iid = '$edit[iid]'"); + db_query("UPDATE item SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', author = '". check_input($edit[author]) ."', description = '". check_input($edit[description]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE iid = '$edit[iid]'"); } else if ($edit[iid]) { db_query("DELETE FROM item WHERE iid = '". check_input($edit[iid]) ."'"); } else { if (!db_fetch_object(db_query("SELECT iid FROM item WHERE link = '". check_input($edit[link]) ."'"))) { - db_query("INSERT INTO item (fid, title, link, author, description, attribute, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attribute]) ."', '". time() ."')"); + db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit[fid]) ."', '". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[author]) ."', '". check_input($edit[description]) ."', '". check_input($edit[attributes]) ."', '". time() ."')"); } } } @@ -113,7 +113,7 @@ function import_form_bundle($edit = array()) { global $REQUEST_URI; $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -127,13 +127,13 @@ function import_form_bundle($edit = array()) { function import_save_bundle($edit) { if ($edit[bid] && $edit[title]) { - db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attribute = '". check_input($edit[attribute]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); + db_query("UPDATE bundle SET title = '". check_input($edit[title]) ."', attributes = '". check_input($edit[attributes]) ."' WHERE bid = '". check_input($edit[bid]) ."'"); } else if ($edit[bid]) { db_query("DELETE FROM bundle WHERE bid = '". check_input($edit[bid]) ."'"); } else { - db_query("INSERT INTO bundle (title, attribute) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attribute]) ."')"); + db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[attributes]) ."')"); } module_rehash_blocks("import"); @@ -146,7 +146,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit[title], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Link", "link", $edit[link], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attribute", $edit[attribute], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 128, "A comma-seperated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit[refresh], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_select("Expiration time", "uncache", $edit[uncache], $period, "The time cached items should be kept. Older items will be automatically discarded. Requires crontab."); @@ -162,7 +162,7 @@ function import_form_feed($edit = array()) { function import_save_feed($edit) { if ($edit[fid] && $edit[title]) { - db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attribute = '". check_input($edit[attribute]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); + db_query("UPDATE feed SET title = '". check_input($edit[title]) ."', link = '". check_input($edit[link]) ."', attributes = '". check_input($edit[attributes]) ."', refresh = '". check_input($edit[refresh]) ."', uncache = '". check_input($edit[uncache]) ."' WHERE fid = '". check_input($edit[fid]) ."'"); db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else if ($edit[fid]) { @@ -170,13 +170,13 @@ function import_save_feed($edit) { db_query("DELETE FROM item WHERE fid = '". check_input($edit[fid]) ."'"); } else { - db_query("INSERT INTO feed (title, link, attribute, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attribute]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); + db_query("INSERT INTO feed (title, link, attributes, refresh, uncache) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[link]) ."', '". check_input($edit[attributes]) ."', '". check_input($edit[refresh]) ."', '". check_input($edit[uncache]) ."')"); } } function import_save_attributes($edit) { foreach($edit as $iid => $value) { - db_query("UPDATE item SET attribute = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); + db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'"); } return "attributes has been saved"; } @@ -196,7 +196,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>items</TH><TH>last update</TH><TH>next update</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($feed = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attribute) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($feed->title) ."</TD><TD>". check_output($feed->attributes) ."</TD><TD>". format_plural($feed->items, "item", "items") ."</TD><TD>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</TD><TD>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</A></TD><TD><A HREF=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -206,7 +206,7 @@ function import_view_feed() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>attributes</TH><TH>operations</TH></TR>\n"; while ($bundle = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attribute) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($bundle->title) ."</TD><TD>". check_output($bundle->attributes) ."</TD><TD><A HREF=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</A></TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -222,7 +222,7 @@ function import_view_item() { $output .= "<TABLE BORDER=\"1\" CELLSPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>time</TH><TH>feed</TH><TH>item</TH></TR>\n"; while ($item = db_fetch_object($result)) { - $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attribute) ."\" SIZE=\"50\"></TD></TR>\n"; + $output .= " <TR><TD VALIGN=\"top\" NOWRAP>". format_date($item->timestamp, "custom", "m/d/y") ."<BR>".format_date($item->timestamp, "custom", "H:i") ."</TD><TD ALIGN=\"center\" VALIGN=\"top\" NOWRAP><A HREF=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</A></TD><TD><A HREF=\"". check_output($item->link) ."\">". check_output($item->title) ."</A>". ($item->description ? "<BR><SMALL><I>". check_output($item->description) ."</I></SMALL>" : "") ."<BR><INPUT TYPE=\"text\" NAME=\"edit[$item->iid]\" VALUE=\"". check_form($item->attributes) ."\" SIZE=\"50\"></TD></TR>\n"; } $output .= "</TABLE>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save attributes\">\n"; diff --git a/modules/index.module b/modules/index.module index 0d06a7b22c4ea7df330d786fad7128741f5ca2c8..673e00d69e9e57c4c64672f3bf887a70fc95ed1d 100644 --- a/modules/index.module +++ b/modules/index.module @@ -1,7 +1,7 @@ <?php -// entries => attributes +// entries => attributess function index_get_array($id) { return db_fetch_array(db_query("SELECT * FROM entry WHERE eid = '". check_input($id) ."'")); @@ -88,8 +88,8 @@ function index_test_2($edit) { $value1 = field_merge($value1, $edit[$entry->collection]); } - foreach (explode(";", $value1) as $data) { - $entry = explode(":", $data); + foreach (explode(",", $value1) as $data) { + $entry = explode("=", $data); if ($entry[1]) $foo[] = "<A HREF=\"index.php?$entry[0]=". urlencode($entry[1]) ."\">$entry[1]</A>"; } diff --git a/modules/node.module b/modules/node.module index 6b1df2c8297dbcb65ce82eb1bc5d5e371c947d32..ffbca0d0cd6409e8e5a361d8b9bdca9bc0033fbb 100644 --- a/modules/node.module +++ b/modules/node.module @@ -5,7 +5,7 @@ function Node($node) { global $user; $this->userid = $node[userid] ? $node[userid] : $user->userid; $this->title = $node[title]; - $this->timestamp = $node[attribute]; + $this->timestamp = $node[attributes]; $this->timestamp = $node[timestamp] ? $node[timestamp] : time(); } } @@ -83,7 +83,7 @@ function node_overview($query) { $bg = $color[$i++ % sizeof($color)]; - $output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attribute) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n"; + $output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n"; $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", $link) ."</SMALL></TD>\n"; } $output .= "</TABLE>\n"; @@ -112,7 +112,7 @@ function node_edit_attribute($id) { $node = node_get_object(array("nid" => $id)); $form .= form_item("Document title", check_output($node->title)); - $form .= form_textfield("Attributes", "attribute", $node->attribute, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software:apache;type:webserver;os:linux;'.")); + $form .= form_textfield("Attributes", "attributes", $node->attributes, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software:apache;type:webserver;os:linux;'.")); $form .= form_hidden("nid", $node->nid); $form .= form_submit("Save node"); @@ -204,8 +204,8 @@ function node_admin_save($edit) { $edit[timestamp_hidden] = (strtotime($edit[timestamp_hidden]) > time()) ? strtotime($edit[timestamp_hidden]) : 0; node_save($edit, array(status, timestamp_posted, timestamp_queued, timestamp_hidden)); } - else if (isset($edit[attribute])) { - node_save($edit, array(attribute)); + else if (isset($edit[attributes])) { + node_save($edit, array(attributes)); } else { node_save($edit, array(comment, moderate, promote)); diff --git a/modules/node/node.module b/modules/node/node.module index 6b1df2c8297dbcb65ce82eb1bc5d5e371c947d32..ffbca0d0cd6409e8e5a361d8b9bdca9bc0033fbb 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -5,7 +5,7 @@ function Node($node) { global $user; $this->userid = $node[userid] ? $node[userid] : $user->userid; $this->title = $node[title]; - $this->timestamp = $node[attribute]; + $this->timestamp = $node[attributes]; $this->timestamp = $node[timestamp] ? $node[timestamp] : time(); } } @@ -83,7 +83,7 @@ function node_overview($query) { $bg = $color[$i++ % sizeof($color)]; - $output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attribute) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n"; + $output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n"; $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", $link) ."</SMALL></TD>\n"; } $output .= "</TABLE>\n"; @@ -112,7 +112,7 @@ function node_edit_attribute($id) { $node = node_get_object(array("nid" => $id)); $form .= form_item("Document title", check_output($node->title)); - $form .= form_textfield("Attributes", "attribute", $node->attribute, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software:apache;type:webserver;os:linux;'.")); + $form .= form_textfield("Attributes", "attributes", $node->attributes, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software:apache;type:webserver;os:linux;'.")); $form .= form_hidden("nid", $node->nid); $form .= form_submit("Save node"); @@ -204,8 +204,8 @@ function node_admin_save($edit) { $edit[timestamp_hidden] = (strtotime($edit[timestamp_hidden]) > time()) ? strtotime($edit[timestamp_hidden]) : 0; node_save($edit, array(status, timestamp_posted, timestamp_queued, timestamp_hidden)); } - else if (isset($edit[attribute])) { - node_save($edit, array(attribute)); + else if (isset($edit[attributes])) { + node_save($edit, array(attributes)); } else { node_save($edit, array(comment, moderate, promote)); diff --git a/modules/poll.module b/modules/poll.module index cd9e0e306a4aa728736bab1bd8675c1dc0f5b2c0..df4c64b57408104d6c676661d8b5c2ace1563503 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -232,10 +232,10 @@ function poll_save($edit) { global $status, $user; if (!$edit[nid]) { - $nid = node_save($edit, array(active => 1, attribute => node_attributes_save($edit), author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); + $nid = node_save($edit, array(active => 1, attributes => node_attributes_save($edit), author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); } else if (user_access($user)) { - $nid = node_save($edit, array(active, attribute => node_attributes_save($edit), cid, tid, runtime, title, type => "poll")); + $nid = node_save($edit, array(active, attributes => node_attributes_save($edit), cid, tid, runtime, title, type => "poll")); db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'"); } if ($nid) { diff --git a/modules/poll/poll.module b/modules/poll/poll.module index cd9e0e306a4aa728736bab1bd8675c1dc0f5b2c0..df4c64b57408104d6c676661d8b5c2ace1563503 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -232,10 +232,10 @@ function poll_save($edit) { global $status, $user; if (!$edit[nid]) { - $nid = node_save($edit, array(active => 1, attribute => node_attributes_save($edit), author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); + $nid = node_save($edit, array(active => 1, attributes => node_attributes_save($edit), author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); } else if (user_access($user)) { - $nid = node_save($edit, array(active, attribute => node_attributes_save($edit), cid, tid, runtime, title, type => "poll")); + $nid = node_save($edit, array(active, attributes => node_attributes_save($edit), cid, tid, runtime, title, type => "poll")); db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'"); } if ($nid) { diff --git a/modules/queue.module b/modules/queue.module index 2241952f8ef85bad67911ebeaa45a7f5465fa7f0..b91dab326b9dc1ce73a6e0a77ff152d34f0f57a4 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -10,7 +10,6 @@ function queue_cron() { db_query("UPDATE node SET status = '$status[dumped]' WHERE status = '$status[queued]' AND ". time() ." - timestamp > ". variable_get("queue_clear", 604800)); } - function queue_menu() { return array("<A HREF=\"module.php?mod=queue\">". t("moderation queue") ."</A> (<FONT COLOR=\"red\">". queue_count() ."</FONT>)"); } diff --git a/modules/story.module b/modules/story.module index 3e6f428ce65db3939612e682ee5be19b9f07bc5b..1325c0d3f300f3bbe5bf99275c50a5865cc4b2d3 100644 --- a/modules/story.module +++ b/modules/story.module @@ -73,10 +73,10 @@ function story_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(abstract, attribute => node_attributes_save($edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); + node_save($edit, array(abstract, attributes => node_attributes_save($edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); } else if (user_access($user)) { - node_save($edit, array(abstract, attribute => node_attributes_save($edit), body, title, type => "story")); + node_save($edit, array(abstract, attributes => node_attributes_save($edit), body, title, type => "story")); } } diff --git a/modules/story/story.module b/modules/story/story.module index 3e6f428ce65db3939612e682ee5be19b9f07bc5b..1325c0d3f300f3bbe5bf99275c50a5865cc4b2d3 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -73,10 +73,10 @@ function story_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(abstract, attribute => node_attributes_save($edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); + node_save($edit, array(abstract, attributes => node_attributes_save($edit), author => $user->id, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); } else if (user_access($user)) { - node_save($edit, array(abstract, attribute => node_attributes_save($edit), body, title, type => "story")); + node_save($edit, array(abstract, attributes => node_attributes_save($edit), body, title, type => "story")); } } diff --git a/themes/example/example.theme b/themes/example/example.theme index dae6300a09dd2336aec05e93d8dd401ed90fc756..e53496b6884c46ae2a149f719fbcb4937303d9cc 100644 --- a/themes/example/example.theme +++ b/themes/example/example.theme @@ -69,7 +69,7 @@ function node($node, $main = 0, $links = 0) { </TD> <TD ALIGN="right"> <?php - echo node_index($node->attribute); + echo node_index($node); ?> </TD> </TR> diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme index 89d4a3343749e2d2daaffd4ccb18e44dc2ae7c25..c704b2f35e51b70a0ced586fa0ebd4db02b36a38 100644 --- a/themes/goofy/goofy.theme +++ b/themes/goofy/goofy.theme @@ -103,7 +103,7 @@ function node($node, $main = 0, $links = 0) { echo "\n<!-- node: \"$node->title\" -->\n"; $title = check_output($node->title); $subleft = strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))); - $subright = node_index($node->attribute); + $subright = node_index($node); $body = check_output($node->body, 1) . (node_links($links, $node, $main) ? "<hr color=\"#404040\" size=\"1\"><div align=\"right\">" . $this->links($links, $main) . "</div>" : ""); print "<script language=\"JavaScript\"><!--\ns(\"". $this->stripbreaks(addslashes($title)) ."\",\"". $this->stripbreaks(addslashes($subleft)) ."\",\"". $this->stripbreaks(addslashes($subright)) ."\",\"". $this->stripbreaks(addslashes($body)) ."\"); // -->\n</script>\n"; } // close node function diff --git a/themes/jeroen/jeroen.theme b/themes/jeroen/jeroen.theme index 8af5974356d2fcf9ee577b258fafb32480fd425a..c5685f3261d3b586b61e9acaf32423d00a78f361 100644 --- a/themes/jeroen/jeroen.theme +++ b/themes/jeroen/jeroen.theme @@ -122,7 +122,7 @@ function node($node, $main = 0, $links = 0) { </FONT> </td> <?php - echo "<td align=\"right\" background=\"themes/jeroen/images/menutitle.gif\" nowrap><b>". node_index($node->attribute) ."</b>"; + echo "<td align=\"right\" background=\"themes/jeroen/images/menutitle.gif\" nowrap><b>". node_index($node) ."</b>"; ?> </td> </tr> diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 15d11eb62375a2b50ff05b3d24c3a2092e046d96..b6f875904ef02f7f01ae123e019e69683f722e6d 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -55,7 +55,7 @@ function node($node, $main = 0, $links = 0) { print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n"; print " <TR>\n"; print " <TD>\n"; - print " <FONT COLOR=\"#7C7C7C\"><SMALL>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))); ?><?php print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL>". node_index($node->attribute) ."</SMALL>\n"; + print " <FONT COLOR=\"#7C7C7C\"><SMALL>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))); ?><?php print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL>". node_index($node) ."</SMALL>\n"; print " </TD>\n"; print " </TR>\n"; print " <TR><TD COLSPAN=\"2\"> </TD></TR>\n"; diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index a2b95a4db1854affcd5fc4a1fb0c23104e9ad514..55da099821e27815eed632838bd6519a20835269 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -89,7 +89,7 @@ function node($node, $main = 0, $links = 0) { <TR><TD COLSPAN="2" BGCOLOR="<?php echo $this->bgcolor1; ?>" WIDTH="100%"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><FONT COLOR="<?php echo $this->fgcolor1; ?>"><B><?php echo "". check_output($node->title) .""; ?></B></FONT></td><td valign="middle" align="center"><IMG SRC="themes/<?php print $this->themename; ?>/images/icon.gif" valign="middle"></td></tr></table></TD></TR> <TR BGCOLOR="<?php echo $this->bgcolor2; ?>"> <?php - print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node->attribute) ."</B>"; + print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . strtr(t("Submitted by %a on %b"), array("%a" => format_username($node->userid), "%b" => format_date($node->timestamp, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node) ."</B>"; ?> </TD> </TR> diff --git a/updates/2.00-to-x.xx.sql b/updates/2.00-to-x.xx.sql index da1b0bd0574c7bf2d56e99045884c0422472a42d..f4c9d3badbafa4487962ae643e0b5e5b23f537b3 100644 --- a/updates/2.00-to-x.xx.sql +++ b/updates/2.00-to-x.xx.sql @@ -219,3 +219,21 @@ ALTER TABLE node ADD attribute varchar(255) DEFAULT '' NOT NULL; # 10/06/01 ALTER TABLE node DROP cid; ALTER TABLE node DROP tid; + +# 11/06/01 +UPDATE users SET access = REPLACE(access, ':', '='); +UPDATE users SET access = REPLACE(access, ';', ','); +UPDATE comments SET users = REPLACE(users, ';', ','); +UPDATE comments SET users = REPLACE(users, ':', '='); +UPDATE node SET users = REPLACE(users, ';', ','); +UPDATE node SET users = REPLACE(users, ':', '='); +UPDATE node SET attributes = REPLACE(attributes, ';', ','); +UPDATE node SET attributes = REPLACE(attributes, ':', '='); +UPDATE entry SET attributes = REPLACE(attributes, ';', ','); +UPDATE entry SET attributes = REPLACE(attributes, ':', '='); + +ALTER TABLE entry CHANGE keyword attributes varchar(255) DEFAULT '' NOT NULL; +ALTER TABLE node CHANGE attribute attributes varchar(255) DEFAULT '' NOT NULL; +ALTER TABLE bundle CHANGE attribute attributes varchar(255) DEFAULT '' NOT NULL; +ALTER TABLE feed CHANGE attribute attributes varchar(255) DEFAULT '' NOT NULL; +ALTER TABLE item CHANGE attribute attributes varchar(255) DEFAULT '' NOT NULL;