summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/blog.module2
-rw-r--r--modules/blog/blog.module2
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/node.module33
-rw-r--r--modules/node/node.module33
6 files changed, 44 insertions, 30 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 1a2aa8d3c..7aba6d5dc 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -341,7 +341,7 @@ function blog_block() {
while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
}
- $output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
+ $output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
$block[0]["content"] = $output;
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 1a2aa8d3c..7aba6d5dc 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -341,7 +341,7 @@ function blog_block() {
while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n";
}
- $output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
+ $output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
$block[0]["content"] = $output;
}
diff --git a/modules/comment.module b/modules/comment.module
index 3dc248914..1d8930f21 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -667,7 +667,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) {
- $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid ."#". $comment->cid)) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
+ $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid), $comment->cid) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
}
$output .= "</table>";
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 3dc248914..1d8930f21 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -667,7 +667,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) {
- $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid ."#". $comment->cid)) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
+ $output .= "<tr><td>". l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid), "node", $comment->cid) ."</td><td>". format_name($comment) ."</td><td>". l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid), $comment->cid) ."</td><td>". la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid)) ."</td><td>". la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid)) ."</td></tr>";
}
$output .= "</table>";
diff --git a/modules/node.module b/modules/node.module
index 4a3d8d842..f70e2173f 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -671,31 +671,38 @@ function node_block() {
return $block;
}
-function node_feed() {
-
- $result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15");
-
- while ($node = db_fetch_object($result)) {
- $item = node_load(array("nid" => $node->nid, "type" => $node->type));
+function node_feed($nodes = 0, $channel = array()) {
+ /*
+ a generic function for generating rss feeds from a set of nodes.
+ $nodes should be an object as returned by db_query() which contains the nid field
+ $channel is an associative array containing title, link, and description keys
+ */
- $link = path_uri() .drupal_url(array("id" => $item->nid), "node");
+ if (!$nodes) {
+ $nodes = db_query("SELECT nid FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15");
+ }
+ while ($node = db_fetch_object($nodes)) {
+ $item = node_load(array("nid" => $node->nid));
+ $link = path_uri(). drupal_url(array("id" => $item->nid), "node");
$items .= format_rss_item($item->title, $link, $item->teaser);
}
- $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<?xml version=\"1.0\" ". t("encoding=\"ISO-8859-1\""). "?>\n";
// $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
- $output .= "<rss version=\"0.91\">\n";
- $output .= format_rss_channel(variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", ""), path_uri(), variable_get("site_mission", ""), $items);
+ if (!$channel["version"]) $channel["version"] = "0.91";
+ if (!$channel["title"]) $channel["title"] = variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", "");
+ if (!$channel["link"]) $channel["link"] = path_uri();
+ if (!$channel["description"]) $channel["description"] = variable_get("site_mission", "");
+ if (!$channel["language"]) $channel["language"] = "en";
+ $output .= "<rss version=\"". $channel["version"] . "\">\n";
+ $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"]);
$output .= "</rss>\n";
header("Content-Type: text/xml");
-
print $output;
-
}
-
function node_validate($node, &$error) {
global $user;
diff --git a/modules/node/node.module b/modules/node/node.module
index 4a3d8d842..f70e2173f 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -671,31 +671,38 @@ function node_block() {
return $block;
}
-function node_feed() {
-
- $result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15");
-
- while ($node = db_fetch_object($result)) {
- $item = node_load(array("nid" => $node->nid, "type" => $node->type));
+function node_feed($nodes = 0, $channel = array()) {
+ /*
+ a generic function for generating rss feeds from a set of nodes.
+ $nodes should be an object as returned by db_query() which contains the nid field
+ $channel is an associative array containing title, link, and description keys
+ */
- $link = path_uri() .drupal_url(array("id" => $item->nid), "node");
+ if (!$nodes) {
+ $nodes = db_query("SELECT nid FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15");
+ }
+ while ($node = db_fetch_object($nodes)) {
+ $item = node_load(array("nid" => $node->nid));
+ $link = path_uri(). drupal_url(array("id" => $item->nid), "node");
$items .= format_rss_item($item->title, $link, $item->teaser);
}
- $output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
+ $output .= "<?xml version=\"1.0\" ". t("encoding=\"ISO-8859-1\""). "?>\n";
// $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
- $output .= "<rss version=\"0.91\">\n";
- $output .= format_rss_channel(variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", ""), path_uri(), variable_get("site_mission", ""), $items);
+ if (!$channel["version"]) $channel["version"] = "0.91";
+ if (!$channel["title"]) $channel["title"] = variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", "");
+ if (!$channel["link"]) $channel["link"] = path_uri();
+ if (!$channel["description"]) $channel["description"] = variable_get("site_mission", "");
+ if (!$channel["language"]) $channel["language"] = "en";
+ $output .= "<rss version=\"". $channel["version"] . "\">\n";
+ $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"]);
$output .= "</rss>\n";
header("Content-Type: text/xml");
-
print $output;
-
}
-
function node_validate($node, &$error) {
global $user;