diff options
author | Dries Buytaert <dries@buytaert.net> | 2000-12-27 12:44:27 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2000-12-27 12:44:27 +0000 |
commit | 2714fae603e66ded154b983c8d04e6dca19eb55f (patch) | |
tree | efd4dd6e03d99c88840d1916ae5e6d0b2c677e3e | |
parent | 42fbefddff0029e741a5f4f2e3d49ef810ac79e4 (diff) | |
download | brdo-2714fae603e66ded154b983c8d04e6dca19eb55f.tar.gz brdo-2714fae603e66ded154b983c8d04e6dca19eb55f.tar.bz2 |
- small bugfixes and standarized "export" routines for modules to use.
-rw-r--r-- | export | 6 | ||||
-rw-r--r-- | modules/diary.module | 9 | ||||
-rw-r--r-- | modules/documentation.module | 4 | ||||
-rw-r--r-- | modules/headline.module (renamed from modules/backend.module) | 98 | ||||
-rw-r--r-- | syndicate.rdf | 9 | ||||
-rw-r--r-- | themes/marvin/marvin.theme | 6 |
6 files changed, 68 insertions, 64 deletions
@@ -2,8 +2,10 @@ include "includes/common.inc"; -if ($repository["backend"]) { - backend_rdf(); +function export($name, $module) { + global $REQUEST_URI; + module_execute($name, "export", explode("/", $REQUEST_URI)); } +module_iterate("export"); ?>
\ No newline at end of file diff --git a/modules/diary.module b/modules/diary.module index 90981b3bd..0e938d28c 100644 --- a/modules/diary.module +++ b/modules/diary.module @@ -2,7 +2,8 @@ $module = array("page" => "diary_page", "block" => "diary_block", - "admin" => "diary_admin"); + "admin" => "diary_admin", + "export" => "diary_export"); include "includes/common.inc"; @@ -297,4 +298,10 @@ function diary_admin() { } } +function diary_export($uri) { + if ($uri[2] == "diary") { + print "TODO: export diary for user $uri[3]"; + } +} + ?> diff --git a/modules/documentation.module b/modules/documentation.module index 887a67104..ae2053496 100644 --- a/modules/documentation.module +++ b/modules/documentation.module @@ -99,8 +99,8 @@ function documentation_page() { <TD VALIGN="top">If a module requires a spot in the administrator section it should implement <CODE>module_admin</CODE>. The engine will automatically add a link to the administration menus and will call <CODE>module_admin</CODE> when this link is followed. In order to make virtually any module maintainer's life easier, you don't have to worry about access rights or permissions for that matter. The engine will only allow priveleged users to call exported <CODE>admin</CODE> functions.</TD> </TR> <TR> - <TD VALIGN="top"></TD> - <TD VALIGN="top"></TD> + <TD VALIGN="top"><CODE>export</CODE></TD> + <TD VALIGN="top">... All you have to do is examine the string and figure out where you're at.</TD> </TR> <TR> <TD VALIGN="top"></TD> diff --git a/modules/backend.module b/modules/headline.module index a06b26caa..fd405dc17 100644 --- a/modules/backend.module +++ b/modules/headline.module @@ -1,43 +1,16 @@ <? -$module = array("page" => "backend_page", - "cron" => "backend_cron", - "block" => "backend_block", - "admin" => "backend_admin"); +$module = array("page" => "headline_page", + "cron" => "headline_cron", + "block" => "headline_block", + "admin" => "headline_admin", + "export" => "headline_export"); include "includes/common.inc"; include "modules/backend.class"; -function backend_rdf() { - global $site_name, $site_url; - - 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>$site_name</title>\n"; - print " <link>$site_url</link>\n"; - print " <description>$site_name</description>\n"; - print "</channel>\n"; - - $result = db_query("SELECT * FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT 10"); - - while ($story = db_fetch_object($result)) { - print "<item>\n"; - print " <title>$story->subject</title>\n"; - print " <link>". $site_url ."discussion.php?id=$story->id</link>\n"; - print "</item>\n"; - } - - print "</rdf:RDF>\n"; -} - -function backend_blocks() { +function headline_blocks() { global $theme; // Get channel info: @@ -54,9 +27,9 @@ function backend_blocks() { // Load backend from database: $backend = new backend($channel->id); - // Read headlines from backend class: + // Read headline from backend class: $content = ""; - for (reset($backend->headlines); $headline = current($backend->headlines); next($backend->headlines)) { + for (reset($backend->headline); $headline = current($backend->headline); next($backend->headline)) { $content .= "<LI>$headline</LI>\n"; } @@ -73,44 +46,44 @@ function backend_blocks() { $theme->footer(); } -function backend_page() { +function headline_page() { global $type; switch($type) { case "rdf": - backend_rdf(); + headline_rdf(); break; default: - backend_blocks(); + headline_blocks(); } } -function backend_cron() { +function headline_cron() { $result = db_query("SELECT * FROM channel"); while ($channel = db_fetch_object($result)) { $backend = new Backend($channel->id); } } -function backend_block() { +function headline_block() { $result = db_query("SELECT * FROM channel"); while ($channel = db_fetch_object($result)) { $backend = new Backend($channel->id); $content = ""; - for (reset($backend->headlines); $headline = current($backend->headlines); next($backend->headlines)) { + for (reset($backend->headline); $headline = current($backend->headline); next($backend->headline)) { $content .= "<LI>$headline</LI>\n"; } $blocks[$channel->id]["subject"] = $backend->site; $blocks[$channel->id]["content"] = $content; - $blocks[$channel->id]["info"] = "$backend->site headlines"; + $blocks[$channel->id]["info"] = "$backend->site headline"; $blocks[$channel->id]["link"] = $backend->url; } return $blocks; } -function backend_admin_main() { +function headline_admin_main() { global $theme; // Get channel info: @@ -158,27 +131,58 @@ function backend_admin_main() { print $output; } -function backend_admin() { +function headline_admin() { global $op, $id, $site, $url, $backend, $contact; switch($op) { case "refresh": $backend = new backend($id); $backend->refresh(); - backend_admin_main(); + headline_admin_main(); break; case "delete": $backend = new backend($id); $backend->dump(); $backend->delete(); - backend_admin_main(); + headline_admin_main(); break; case "Add backend": $backend = new backend($id, $site, $url, $backend, $contact); $backend->add(); // fall through: default: - backend_admin_main(); + headline_admin_main(); + } +} + +function headline_export($uri) { + global $site_name, $site_url; + + if ($uri[2] == "headlines.rdf") { + + 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>$site_name</title>\n"; + print " <link>$site_url</link>\n"; + print " <description>$site_name</description>\n"; + print "</channel>\n"; + + $result = db_query("SELECT * FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT 10"); + + while ($story = db_fetch_object($result)) { + print "<item>\n"; + print " <title>$story->subject</title>\n"; + print " <link>". $site_url ."discussion.php?id=$story->id</link>\n"; + print "</item>\n"; + } + + print "</rdf:RDF>\n"; } } diff --git a/syndicate.rdf b/syndicate.rdf deleted file mode 100644 index 6b1fa9457..000000000 --- a/syndicate.rdf +++ /dev/null @@ -1,9 +0,0 @@ -<? - -include "includes/common.inc"; - -if ($repository["backend"]) { - backend_rdf(); -} - -?>
\ No newline at end of file diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 929fcc494..2c952d5d0 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -53,7 +53,7 @@ function abstract($story) { print "\n<!-- story: \"$story->subject\" -->\n"; print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n"; - print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> <B>$story->subject</B></TD></TR>\n"; + print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> <B>". check_output($story->subject) ."</B></TD></TR>\n"; print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n"; print " <TR>\n"; print " <TD>\n"; @@ -76,7 +76,7 @@ function article($story, $reply) { print "\n<!-- story: \"$story->subject\" -->\n"; print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n"; - print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> <B>$story->subject</B></TD></TR>\n"; + print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> <B>". check_output($story->subject) ."</B></TD></TR>\n"; print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n"; print " <TR>\n"; print " <TD>\n"; @@ -244,4 +244,4 @@ } } -?>
\ No newline at end of file +?> |