summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-04-20 20:33:28 +0000
committerDries Buytaert <dries@buytaert.net>2003-04-20 20:33:28 +0000
commit3c2dc18c82fd6fc19d5e2e26bc1f28b0048f89a8 (patch)
treee8895044a66e4a2d330daa1844f8e74aba6a3025 /modules/aggregator
parentb85cf71962c7b0231994131258053916b9ed73cb (diff)
downloadbrdo-3c2dc18c82fd6fc19d5e2e26bc1f28b0048f89a8.tar.gz
brdo-3c2dc18c82fd6fc19d5e2e26bc1f28b0048f89a8.tar.bz2
- Fixed bug #1545: incorrect sequence tables on PostgreSQL. Patch by Neil.
In addition, I have updated update.php so it makes the corresponding changes for MySQL users.
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.module52
1 files changed, 26 insertions, 26 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 22cb55939..a36ef3215 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -92,7 +92,7 @@ function import_bundle_block($attributes) {
}
function import_feed_block($feed) {
- $result = db_query_range("SELECT * FROM item WHERE fid = '%d' ORDER BY iid DESC ", $feed->fid, 0, variable_get("import_block_limit", 15));
+ $result = db_query_range("SELECT * FROM item WHERE fid = %d ORDER BY iid DESC ", $feed->fid, 0, variable_get("import_block_limit", 15));
while ($item = db_fetch_object($result)) {
$output .= import_format_item($item);
@@ -119,13 +119,13 @@ function import_block($op, $delta) {
list($type, $id) = split(":", $delta);
switch ($type) {
case "feed":
- $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $id));
+ $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = %d", $id));
$block["subject"] = $feed->title;
$block["content"] .= import_feed_block($feed) ."<div align=\"right\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>";
break;
case "bundle":
- $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $id));
+ $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = %d", $id));
$block["subject"] = $bundle->title;
$block["content"] .= import_bundle_block($bundle->attributes) ."<div align=\"right\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>";
break;
@@ -168,7 +168,7 @@ function import_get_feeds($attributes = 0) {
}
function import_remove($feed) {
- db_query("DELETE FROM item WHERE fid = '%d'", $feed["fid"]);
+ db_query("DELETE FROM item WHERE fid = %d", $feed["fid"]);
return t("removed news items from '%site'.", array("%site" => $feed["title"]));
}
@@ -270,7 +270,7 @@ function import_refresh($feed) {
$channel[$key] = filter(strtr(trim($value), $tt));
}
- db_query("UPDATE feed SET timestamp = '%d', link = '%s', description = '%s' WHERE fid = '%d'", time(), $channel["LINK"], $channel["DESCRIPTION"], $feed["fid"]);
+ db_query("UPDATE feed SET timestamp = %d, link = '%s', description = '%s' WHERE fid = %d", time(), $channel["LINK"], $channel["DESCRIPTION"], $feed["fid"]);
/*
** We reverse the array such that we store the first item last,
@@ -316,10 +316,10 @@ function import_refresh($feed) {
*/
if ($link && $link != $feed["link"] && $link != $feed["url"]) {
- $entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%d' AND link = '%s'", $feed["fid"], $link));
+ $entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = %d AND link = '%s'", $feed["fid"], $link));
}
else {
- $entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%d' AND title = '%s'", $feed["fid"], $title));
+ $entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = %d AND title = '%s'", $feed["fid"], $title));
}
import_save_item(array(iid => $entry->iid, fid => $feed["fid"], title => $title, link => $link, author => $item["AUTHOR"], description => $item["DESCRIPTION"], attributes => $feed["attributes"]));
@@ -331,7 +331,7 @@ function import_refresh($feed) {
unset($items);
- $result = db_query("SELECT iid FROM item WHERE fid = '%d' ORDER BY timestamp", $feed["fid"]);
+ $result = db_query("SELECT iid FROM item WHERE fid = %d ORDER BY timestamp", $feed["fid"]);
while ($item = db_fetch_object($result)) {
$items[] = "iid = '$item->iid'";
@@ -351,10 +351,10 @@ function import_refresh($feed) {
function import_save_item($edit) {
if ($edit["iid"] && $edit["title"]) {
- db_query("UPDATE item SET title = '%s', link = '%s', author = '%s', description = '%s', attributes = '%s' WHERE iid = '%d'", $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], $edit["iid"]);
+ db_query("UPDATE item SET title = '%s', link = '%s', author = '%s', description = '%s', attributes = '%s' WHERE iid = %d", $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], $edit["iid"]);
}
else if ($edit["iid"]) {
- db_query("DELETE FROM item WHERE iid = '%d'", $edit["iid"]);
+ db_query("DELETE FROM item WHERE iid = %d", $edit["iid"]);
}
else if ($edit["title"] && $edit["link"]) {
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
@@ -378,15 +378,15 @@ function import_form_bundle($edit = array()) {
function import_save_bundle($edit) {
if ($edit["bid"] && $edit["title"]) {
- db_query("UPDATE bundle SET title = '%s', attributes = '%s' WHERE bid = '%d'", $edit["title"], $edit["attributes"], $edit["bid"]);
+ db_query("UPDATE bundle SET title = '%s', attributes = '%s' WHERE bid = %d", $edit["title"], $edit["attributes"], $edit["bid"]);
}
else if ($edit["bid"]) {
- db_query("DELETE FROM bundle WHERE bid = '%d'", $edit["bid"]);
+ db_query("DELETE FROM bundle WHERE bid = %d", $edit["bid"]);
}
else if ($edit["title"]) {
// a single unique id for bundles and feeds, to use in blocks
- $next_id = db_next_id("import");
- db_query("INSERT INTO bundle (bid, title, attributes) VALUES ('%d', '%s', '%s')", $next_id, $edit["title"], $edit["attributes"]);
+ $next_id = db_next_id("bundle_bid");
+ db_query("INSERT INTO bundle (bid, title, attributes) VALUES (%d, '%s', '%s')", $next_id, $edit["title"], $edit["attributes"]);
}
}
@@ -415,33 +415,33 @@ function import_form_feed($edit = array()) {
function import_save_feed($edit) {
if ($edit["fid"] && $edit["title"]) {
- db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = '%d'", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
- db_query("DELETE FROM item WHERE fid = '%d'", $edit["fid"]);
+ db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
+ db_query("DELETE FROM item WHERE fid = %d", $edit["fid"]);
}
else if ($edit["fid"]) {
- db_query("DELETE FROM feed WHERE fid = '%d'", $edit["fid"]);
- db_query("DELETE FROM item WHERE fid = '%d'", $edit["fid"]);
+ db_query("DELETE FROM feed WHERE fid = %d", $edit["fid"]);
+ db_query("DELETE FROM item WHERE fid = %d", $edit["fid"]);
}
else if ($edit["title"]) {
// a single unique id for bundles and feeds, to use in blocks
- $next_id = db_next_id("import");
- db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES ('%d', '%s', '%s', '%s', '%s')", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
+ $next_id = db_next_id("feed_fid");
+ db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', '%s')", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
}
}
function import_save_attributes($edit) {
foreach ($edit as $iid => $value) {
- db_query("UPDATE item SET attributes = '%s' WHERE iid = '%d'", $value, $iid);
+ db_query("UPDATE item SET attributes = '%s' WHERE iid = %d", $value, $iid);
}
return "attributes has been saved";
}
function import_get_feed($fid) {
- return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '%d'", $fid));
+ return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = %d", $fid));
}
function import_get_bundle($bid) {
- return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '%d'", $bid));
+ return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = %d", $bid));
}
function import_view() {
@@ -594,13 +594,13 @@ function import_page_last() {
function import_page_feed($fid) {
- $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $fid));
+ $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = %d", $fid));
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\"><a href=\"$feed->link\">$feed->link</a></div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">$feed->description</div></p>";
$header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ." <a href=\"$feed->url\"><img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" alt=\"\" /></a><br /><br /></div></p>\n";
- $result = db_query_range("SELECT * FROM item WHERE fid = '%d' ORDER BY iid DESC", $fid, 0, variable_get("import_page_limit", 75));
+ $result = db_query_range("SELECT * FROM item WHERE fid = %d ORDER BY iid DESC", $fid, 0, variable_get("import_page_limit", 75));
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) {
@@ -630,7 +630,7 @@ function import_page_feed($fid) {
function import_page_bundle($bid) {
- $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $bid));
+ $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = %d", $bid));
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". l($bundle->title, "import/bundle/$bundle->bid") ."</div></p>";
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." $bundle->attributes.</div></p>";