Commit a6121c15 authored by Kjartan's avatar Kjartan
Browse files

- fixing some incorrect l*() calls.

- fixing node_feed() to work with tax feeds. Thanks Moshe.
parent 66ccfb3f
...@@ -341,7 +341,7 @@ function blog_block() { ...@@ -341,7 +341,7 @@ function blog_block() {
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n"; $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; $block[0]["content"] = $output;
} }
......
...@@ -341,7 +341,7 @@ function blog_block() { ...@@ -341,7 +341,7 @@ function blog_block() {
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$output .= l(check_output($node->title), array("id" => $node->nid)) ."<br />\n"; $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; $block[0]["content"] = $output;
} }
......
...@@ -667,7 +667,7 @@ function comment_node_link($node) { ...@@ -667,7 +667,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>"; $output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) { 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>"; $output .= "</table>";
......
...@@ -667,7 +667,7 @@ function comment_node_link($node) { ...@@ -667,7 +667,7 @@ function comment_node_link($node) {
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>"; $output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
while ($comment = db_fetch_object($result)) { 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>"; $output .= "</table>";
......
...@@ -671,31 +671,38 @@ function node_block() { ...@@ -671,31 +671,38 @@ function node_block() {
return $block; return $block;
} }
function node_feed() { function node_feed($nodes = 0, $channel = array()) {
/*
$result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15"); 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
while ($node = db_fetch_object($result)) { $channel is an associative array containing title, link, and description keys
$item = node_load(array("nid" => $node->nid, "type" => $node->type)); */
$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); $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 .= "<!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"; if (!$channel["version"]) $channel["version"] = "0.91";
$output .= format_rss_channel(variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", ""), path_uri(), variable_get("site_mission", ""), $items); 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"; $output .= "</rss>\n";
header("Content-Type: text/xml"); header("Content-Type: text/xml");
print $output; print $output;
} }
function node_validate($node, &$error) { function node_validate($node, &$error) {
global $user; global $user;
......
...@@ -671,31 +671,38 @@ function node_block() { ...@@ -671,31 +671,38 @@ function node_block() {
return $block; return $block;
} }
function node_feed() { function node_feed($nodes = 0, $channel = array()) {
/*
$result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY created DESC LIMIT 15"); 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
while ($node = db_fetch_object($result)) { $channel is an associative array containing title, link, and description keys
$item = node_load(array("nid" => $node->nid, "type" => $node->type)); */
$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); $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 .= "<!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"; if (!$channel["version"]) $channel["version"] = "0.91";
$output .= format_rss_channel(variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", ""), path_uri(), variable_get("site_mission", ""), $items); 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"; $output .= "</rss>\n";
header("Content-Type: text/xml"); header("Content-Type: text/xml");
print $output; print $output;
} }
function node_validate($node, &$error) { function node_validate($node, &$error) {
global $user; global $user;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment