summaryrefslogtreecommitdiff
path: root/modules/aggregator.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-11 20:01:13 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-11 20:01:13 +0000
commitc56ee67e29e89f5158801ba7bbe8f574a93215b4 (patch)
tree4004e19edda73708f7af1baffeb39318b3984509 /modules/aggregator.module
parent8f315f4506220c50715ba81444326cc7fd936ed9 (diff)
downloadbrdo-c56ee67e29e89f5158801ba7bbe8f574a93215b4.tar.gz
brdo-c56ee67e29e89f5158801ba7bbe8f574a93215b4.tar.bz2
- 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
Diffstat (limited to 'modules/aggregator.module')
-rw-r--r--modules/aggregator.module38
1 files changed, 19 insertions, 19 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 8545ad000..460084c44 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";