Commit af7d8ebe authored by Dries's avatar Dries

- Various updates, mostly related to our RDF/RSS backend.
parent 18f2a5e3
......@@ -13,7 +13,9 @@ function module_iterate($function, $argument = "") {
// invoke hook $hook of module $name with optional arguments:
function module_invoke($name, $hook, $a1 = 0, $a2 = 0) {
$function = $name ."_". $hook;
return function_exists($function) ? $function($a1, $a2) : 0;
if (function_exists($function)) {
return $function($a1, $a2);
}
}
// return array of module names (includes lazy module loading):
......
......@@ -26,6 +26,10 @@ function blog_status() {
return array(dumped, posted);
}
function blog_summary($node) {
return $node->body;
}
function blog_feed_user($name = 0, $date = 0) {
global $user;
......
......@@ -26,6 +26,10 @@ function blog_status() {
return array(dumped, posted);
}
function blog_summary($node) {
return $node->body;
}
function blog_feed_user($name = 0, $date = 0) {
global $user;
......
......@@ -13,7 +13,7 @@ function export_export_rdf() {
print "<channel>\n";
print " <title>". variable_get(site_name, "drupal") ."</title>\n";
print " <link>". path_uri() ."</link>\n";
print " <description>". variable_get(site_name, "drupal") ."</description>\n";
print " <description>". variable_get(site_slogan, "") ."</description>\n";
print "</channel>\n";
$result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
......@@ -42,7 +42,7 @@ function export_export_rss() {
print "<channel rdf:about=\"". path_uri() ."export.php?headlines.rss\">\n";
print " <title>". variable_get(site_name, "drupal") ."</title>\n";
print " <link>". path_uri() ."</link>\n";
print " <description>". variable_get(site_name, "drupal") ."</description>\n";
print " <description>". variable_get(site_slogan, "") ."</description>\n";
print " <items>\n";
print " <rdf:Seq>\n";
......
......@@ -274,7 +274,6 @@ function node_module_find() {
return $output;
}
function node_edit($node) {
$output .= form_item("Title", $node->title);
$output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
......@@ -362,4 +361,44 @@ function node_admin() {
}
}
function node_block() {
global $theme;
$block[0][subject] = t("Syndicate");
$block[0][content] = "<div align=\"center\"><a href=\"module.php?mod=blog&op=feed\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" /></a></div>\n";
$block[0][info] = "Syndicate";
return $block;
}
function node_feed() {
$result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '". node_status("posted") ."' ORDER BY timestamp DESC LIMIT 15");
while ($node = db_fetch_object($result)) {
$item = node_get_object(array("nid" => $node->nid, "type" => $node->type));
$title = $item->title;
$link = path_uri() ."node.php?id=$item->nid";
$description = module_invoke($item->type, "summary", $item);
$items .= format_rss_item($title, $link, $description);
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items);
$output .= "</rss>\n";
print $output;
}
function node_page() {
global $op;
if ($op == "feed") {
node_feed();
}
}
?>
......@@ -274,7 +274,6 @@ function node_module_find() {
return $output;
}
function node_edit($node) {
$output .= form_item("Title", $node->title);
$output .= form_item("Operations", implode("<br />", node_links($node->nid, $node->type)));
......@@ -362,4 +361,44 @@ function node_admin() {
}
}
function node_block() {
global $theme;
$block[0][subject] = t("Syndicate");
$block[0][content] = "<div align=\"center\"><a href=\"module.php?mod=blog&op=feed\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" /></a></div>\n";
$block[0][info] = "Syndicate";
return $block;
}
function node_feed() {
$result = db_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '". node_status("posted") ."' ORDER BY timestamp DESC LIMIT 15");
while ($node = db_fetch_object($result)) {
$item = node_get_object(array("nid" => $node->nid, "type" => $node->type));
$title = $item->title;
$link = path_uri() ."node.php?id=$item->nid";
$description = module_invoke($item->type, "summary", $item);
$items .= format_rss_item($title, $link, $description);
}
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$output .= "<rss version=\"0.91\">\n";
$output .= format_rss_channel(variable_get("site_name", "drupal"), path_uri() ."module.php?mod=node&op=feed", variable_get("site_slogan", ""), $items);
$output .= "</rss>\n";
print $output;
}
function node_page() {
global $op;
if ($op == "feed") {
node_feed();
}
}
?>
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