summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database/database.mssql2
-rw-r--r--database/database.mysql2
-rw-r--r--database/database.pgsql2
-rw-r--r--modules/aggregator.module43
-rw-r--r--modules/aggregator/aggregator.module43
-rw-r--r--modules/block.module6
-rw-r--r--modules/block/block.module6
-rw-r--r--modules/import.module43
-rw-r--r--update.php7
9 files changed, 92 insertions, 62 deletions
diff --git a/database/database.mssql b/database/database.mssql
index e059fc5b3..54b223383 100644
--- a/database/database.mssql
+++ b/database/database.mssql
@@ -25,7 +25,7 @@ GO
CREATE TABLE [dbo].[blocks] (
[module] [varchar] (64) NOT NULL ,
- [delta] [smallint] NOT NULL ,
+ [delta] [varchar] (32) NOT NULL ,
[status] [smallint] NOT NULL ,
[weight] [smallint] NOT NULL ,
[region] [smallint] NOT NULL ,
diff --git a/database/database.mysql b/database/database.mysql
index f05c13049..6eae606ec 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -47,7 +47,7 @@ CREATE TABLE authmap (
CREATE TABLE blocks (
module varchar(64) DEFAULT '' NOT NULL,
- delta tinyint(2) DEFAULT '0' NOT NULL,
+ delta varchar(32) NOT NULL default '0',
status tinyint(2) DEFAULT '0' NOT NULL,
weight tinyint(1) DEFAULT '0' NOT NULL,
region tinyint(1) DEFAULT '0' NOT NULL,
diff --git a/database/database.pgsql b/database/database.pgsql
index 8b6972c9a..dda55d3b7 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -45,7 +45,7 @@ CREATE TABLE authmap (
CREATE TABLE blocks (
module varchar(64) NOT NULL default '',
- delta smallint NOT NULL default '0',
+ delta varchar(32) NOT NULL default '0',
status smallint NOT NULL default '0',
weight smallint NOT NULL default '0',
region smallint NOT NULL default '0',
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 55f21aef4..22cb55939 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -105,27 +105,30 @@ function import_block($op, $delta) {
if ($op == "list") {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
}
else {
- $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
- if ($feed) {
- $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>";
- }
- else {
- // it was a bundle. this is NOT elegant
- $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
- $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>";
+ list($type, $id) = split(":", $delta);
+ switch ($type) {
+ case "feed":
+ $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));
+ $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;
}
return $block;
@@ -138,9 +141,11 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["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>";
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["subject"] = $bundle->title;
+ $block["bundle:$bundle->bid"]["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>";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
return $block;
@@ -152,9 +157,11 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["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>";
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["subject"] = $feed->title;
+ $block["feed:$feed->fid"]["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>";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 55f21aef4..22cb55939 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -105,27 +105,30 @@ function import_block($op, $delta) {
if ($op == "list") {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
}
else {
- $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
- if ($feed) {
- $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>";
- }
- else {
- // it was a bundle. this is NOT elegant
- $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
- $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>";
+ list($type, $id) = split(":", $delta);
+ switch ($type) {
+ case "feed":
+ $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));
+ $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;
}
return $block;
@@ -138,9 +141,11 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["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>";
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["subject"] = $bundle->title;
+ $block["bundle:$bundle->bid"]["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>";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
return $block;
@@ -152,9 +157,11 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["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>";
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["subject"] = $feed->title;
+ $block["feed:$feed->fid"]["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>";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
diff --git a/modules/block.module b/modules/block.module
index ff8793ef4..38835cabe 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -77,7 +77,8 @@ function block_block($op = "list", $delta = 0) {
function block_admin_save($edit) {
foreach ($edit as $module => $blocks) {
foreach ($blocks as $delta => $block) {
- db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%d'", $block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
+ db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%s'",
+ $block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
}
}
@@ -118,7 +119,8 @@ function _block_rehash($order_by = array("weight")) {
}
// reinsert blocks into table
- db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%d', '%d', '%d', '%d', '%s', '%d')", $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
+ db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', '%d', '%d', '%d', '%s', '%d')",
+ $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
diff --git a/modules/block/block.module b/modules/block/block.module
index ff8793ef4..38835cabe 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -77,7 +77,8 @@ function block_block($op = "list", $delta = 0) {
function block_admin_save($edit) {
foreach ($edit as $module => $blocks) {
foreach ($blocks as $delta => $block) {
- db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%d'", $block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
+ db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%s'",
+ $block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
}
}
@@ -118,7 +119,8 @@ function _block_rehash($order_by = array("weight")) {
}
// reinsert blocks into table
- db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%d', '%d', '%d', '%d', '%s', '%d')", $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
+ db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', '%d', '%d', '%d', '%s', '%d')",
+ $block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
diff --git a/modules/import.module b/modules/import.module
index 55f21aef4..22cb55939 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -105,27 +105,30 @@ function import_block($op, $delta) {
if ($op == "list") {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
}
else {
- $feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%d'", $delta));
- if ($feed) {
- $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>";
- }
- else {
- // it was a bundle. this is NOT elegant
- $bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%d'", $delta));
- $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>";
+ list($type, $id) = split(":", $delta);
+ switch ($type) {
+ case "feed":
+ $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));
+ $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;
}
return $block;
@@ -138,9 +141,11 @@ function import_get_bundles($attributes = 0) {
$result = db_query("SELECT * FROM bundle ORDER BY title");
while ($bundle = db_fetch_object($result)) {
- $block[$bundle->bid]["subject"] = $bundle->title;
- $block[$bundle->bid]["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>";
- $block[$bundle->bid]["info"] = "$bundle->title bundle";
+ $block["bundle:$bundle->bid"]["subject"] = $bundle->title;
+ $block["bundle:$bundle->bid"]["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>";
+ $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle";
}
return $block;
@@ -152,9 +157,11 @@ function import_get_feeds($attributes = 0) {
$result = db_query("SELECT * FROM feed ORDER BY fid");
while ($feed = db_fetch_object($result)) {
- $block[$feed->fid]["subject"] = $feed->title;
- $block[$feed->fid]["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>";
- $block[$feed->fid]["info"] = "$feed->title feed";
+ $block["feed:$feed->fid"]["subject"] = $feed->title;
+ $block["feed:$feed->fid"]["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>";
+ $block["feed:$feed->fid"]["info"] = "$feed->title feed";
}
return $block;
diff --git a/update.php b/update.php
index b25566743..a0c02d162 100644
--- a/update.php
+++ b/update.php
@@ -62,7 +62,8 @@ $mysql_updates = array(
"2002-12-29" => "update_47",
"2003-01-03" => "update_48",
"2003-01-05" => "update_49",
- "2003-01-15" => "update_50"
+ "2003-01-15" => "update_50",
+ "2003-04-19" => "update_51"
);
// Update functions
@@ -679,6 +680,10 @@ function update_50() {
update_sql("ALTER TABLE forum ADD INDEX (tid)");
}
+function update_51() {
+ update_sql("ALTER TABLE blocks CHANGE delta delta varchar(32) NOT NULL default '0'");
+}
+
function update_upgrade3() {
update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1)");
update_sql("INSERT INTO system VALUES ('block.module','block','module','',1)");