summaryrefslogtreecommitdiff
path: root/modules/export.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-28 18:53:48 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-28 18:53:48 +0000
commite32241e59ae93dced80d561350e9c45bf1ca264d (patch)
tree1a6c75d68f4f344cc9ad8ae615e2f09e127f450c /modules/export.module
parentcb2850f5c90c0bd293f8ba7e3f2fbc1417a76d30 (diff)
downloadbrdo-e32241e59ae93dced80d561350e9c45bf1ca264d.tar.gz
brdo-e32241e59ae93dced80d561350e9c45bf1ca264d.tar.bz2
- Renamed syndication.module to import.module.
- Removed headline.module: it became obsolete. - Removed backend.class: it became obsolete. - Added export.module. For now, you can use: 1. http://drupal/export.php?headlines.rss 2. http://drupal/export.php?headlines.rdf - Renamed export to export.php. For now, you can use: 1. http://drupal/export.php?headlines.rss 2. http://drupal/export.php?headlines.rdf Renaming this file has main 3 advantages: 1. We no longer rely on .htaccess for being able to export. 2. It is more conform with the general naming conventions. 3. It removes a pseudo-hack with formatting the URI. - Made import.module export blocks with feeds.
Diffstat (limited to 'modules/export.module')
-rw-r--r--modules/export.module87
1 files changed, 87 insertions, 0 deletions
diff --git a/modules/export.module b/modules/export.module
new file mode 100644
index 000000000..b65fa569b
--- /dev/null
+++ b/modules/export.module
@@ -0,0 +1,87 @@
+<?php
+
+function export_export_rdf() {
+ global $status;
+
+ header("Content-Type: text/plain");
+
+ print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
+ print "<rdf:RDF\n";
+ print " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
+ print " xmlns=\"http://my.netscape.com/rdf/simple/0.9/\">\n";
+
+ 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 "</channel>\n";
+
+ $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
+
+ while ($node = db_fetch_object($result)) {
+ print "<item>\n";
+ print " <title>". check_export($node->title) ."</title>\n";
+ print " <link>". path_uri() ."node.php?id=$node->nid</link>\n";
+ print "</item>\n";
+ }
+
+ print "</rdf:RDF>\n";
+}
+
+function export_export_rss() {
+ global $status;
+
+ header("Content-Type: text/plain");
+
+ print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
+ print "<rdf:RDF\n";
+
+ print "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
+ print "xmlns=\"http://purl.org/rss/1.0/\">\n\n";
+
+ print "<channel rdf:about=\"". path_uri() ."export/exportsRSS10.rdf\">\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 " <items>\n";
+ print " <rdf:Seq>\n";
+
+ $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
+
+ while ($node = db_fetch_object($result)) {
+ print " <rdf:li resource=\"". path_uri() ."node.php?id=$node->nid\" />\n";
+ }
+
+ print " </rdf:Seq>\n";
+ print " </items>\n";
+ print "</channel>\n\n";
+
+ $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
+
+ while ($node = db_fetch_object($result)) {
+ print "<item rdf:about=\"". path_uri() ."node.php?id=$node->nid\">\n";
+ print " <title>". check_export($node->title) ."</title>\n";
+ print " <link>". path_uri() ."node.php?id=$node->nid</link>\n";
+
+ if ($node->abstract) print " <description>". check_output($node->abstract, 1) ."</description>\n";
+ if ($node->body) print " <description>". check_output($node->body, 1) ."</description>\n";
+
+ print "</item>\n";
+ }
+
+ print "</rdf:RDF>\n";
+}
+
+function export_export($query) {
+ switch ($query) {
+ case "headlines.rss":
+ export_export_rss();
+ break;
+ case "headlines.rdf":
+ case "default":
+ export_export_rdf();
+ }
+}
+
+?>