diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-11 19:44:24 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-11 19:44:24 +0000 |
commit | 4711869f52897077b52f76b54a74982de3ff0e9b (patch) | |
tree | f2633c6f760e9faba9a825d5feb1a30af566f955 | |
parent | dc93ff3260b15f4660ea40901a9ea227e60b43f1 (diff) | |
download | brdo-4711869f52897077b52f76b54a74982de3ff0e9b.tar.gz brdo-4711869f52897077b52f76b54a74982de3ff0e9b.tar.bz2 |
- fixed a small SQL bug in page.module
- slightly improved story.module, node.module and book.module
- made the "default theme" a setting from the setting page
- polished a bit on the export function: we can now export the
book or parts thereof through the following url:
1. http://drop.org/export/book/
(full book)
2. http://drop.org/export/book/nid
(where nid is the node id to start with)
The export routine demonstrates how it can be done yet the
output is too basic and can only improve over time.
-rw-r--r-- | export | 2 | ||||
-rw-r--r-- | includes/theme.inc | 2 | ||||
-rw-r--r-- | modules/book.module | 35 | ||||
-rw-r--r-- | modules/book/book.module | 35 | ||||
-rw-r--r-- | modules/headline.module | 2 | ||||
-rw-r--r-- | modules/headlineRSS10.module | 2 | ||||
-rw-r--r-- | modules/locale.module | 6 | ||||
-rw-r--r-- | modules/locale/locale.module | 6 | ||||
-rw-r--r-- | modules/node.module | 13 | ||||
-rw-r--r-- | modules/node/node.module | 13 | ||||
-rw-r--r-- | modules/page.module | 21 | ||||
-rw-r--r-- | modules/page/page.module | 21 | ||||
-rw-r--r-- | modules/settings.module | 37 | ||||
-rw-r--r-- | modules/story.module | 12 | ||||
-rw-r--r-- | modules/story/story.module | 12 |
15 files changed, 130 insertions, 89 deletions
@@ -4,7 +4,7 @@ include_once "includes/common.inc"; function export($name, $module) { global $REQUEST_URI; - module_execute($name, "export", explode("/", strrchr($REQUEST_URI, "/export"))); + module_execute($name, "export", explode("/", $REQUEST_URI)); } module_iterate("export"); diff --git a/includes/theme.inc b/includes/theme.inc index c973868b4..9cde011a1 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -7,7 +7,7 @@ function theme_init() { include_once $themes[$user->theme][0]; } else { - include_once $themes[key($themes)][0]; + include_once $themes[variable_get(default_theme, key($themes))][0]; } return new Theme(); } diff --git a/modules/book.module b/modules/book.module index daf314d1c..80a8da754 100644 --- a/modules/book.module +++ b/modules/book.module @@ -3,7 +3,8 @@ $module = array("find" => "book_find", "page" => "book_page", "user" => "book_user", - "admin" => "book_admin"); + "admin" => "book_admin", + "export" => "book_export"); class Book { function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) { @@ -188,18 +189,10 @@ function book_list($query = array()) { function book_query($type = "") { global $status; - $queries = array(0 => array("active book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), 1 => array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function book_listing() { - foreach (book_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=book&type=$key\">$array[0]</A></LI>\n"; - } - return "<OL>$output</OL>\n"; -} - - function book_admin() { global $op, $id, $edit, $mod, $keys, $type, $user; @@ -215,7 +208,7 @@ function book_admin() { print book_form(node_get_array(nid, $id)); break; case "listing": - print book_listing(); + print node_listing(book_query()); break; case "search": print search_form($keys); @@ -288,4 +281,24 @@ function book_user() { } } +function book_export_html($parent = "", $depth = 0) { + global $status; + + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + + while ($node = db_fetch_object($result)) { + $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; + if ($node->body) $output .= check_output($node->body, 1); + if ($node->pid) $output .= book_export_html($node->pid, $depth + 1); + $output .= book_export_html($node->nid, $depth + 1); + } + return $output; +} + +function book_export($uri) { + if ($uri[2] == "book") { + print book_export_html($uri[3], $depth = 1); + } +} + ?> diff --git a/modules/book/book.module b/modules/book/book.module index daf314d1c..80a8da754 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -3,7 +3,8 @@ $module = array("find" => "book_find", "page" => "book_page", "user" => "book_user", - "admin" => "book_admin"); + "admin" => "book_admin", + "export" => "book_export"); class Book { function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) { @@ -188,18 +189,10 @@ function book_list($query = array()) { function book_query($type = "") { global $status; - $queries = array(0 => array("active book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), 1 => array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent book pages", "WHERE n.type = 'book' ORDER BY n.timestamp DESC"), array("posted book pages", "WHERE n.type = 'book' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued book pages", "WHERE n.type = 'book' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped book pages", "WHERE n.type = 'book' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function book_listing() { - foreach (book_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=book&type=$key\">$array[0]</A></LI>\n"; - } - return "<OL>$output</OL>\n"; -} - - function book_admin() { global $op, $id, $edit, $mod, $keys, $type, $user; @@ -215,7 +208,7 @@ function book_admin() { print book_form(node_get_array(nid, $id)); break; case "listing": - print book_listing(); + print node_listing(book_query()); break; case "search": print search_form($keys); @@ -288,4 +281,24 @@ function book_user() { } } +function book_export_html($parent = "", $depth = 0) { + global $status; + + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + + while ($node = db_fetch_object($result)) { + $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; + if ($node->body) $output .= check_output($node->body, 1); + if ($node->pid) $output .= book_export_html($node->pid, $depth + 1); + $output .= book_export_html($node->nid, $depth + 1); + } + return $output; +} + +function book_export($uri) { + if ($uri[2] == "book") { + print book_export_html($uri[3], $depth = 1); + } +} + ?> diff --git a/modules/headline.module b/modules/headline.module index 81a52e580..ac216c53c 100644 --- a/modules/headline.module +++ b/modules/headline.module @@ -191,7 +191,7 @@ function headline_admin() { function headline_export($uri) { global $status, $HTTP_REFERER, $HTTP_USER_AGENT; - if ($uri[1] == "headlines.rdf") { + if ($uri[2] == "headlines.rdf") { watchdog("message", "grabbed 'headlines.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT"); header("Content-Type: text/plain"); diff --git a/modules/headlineRSS10.module b/modules/headlineRSS10.module index 1e15ceb1b..f24b31e42 100644 --- a/modules/headlineRSS10.module +++ b/modules/headlineRSS10.module @@ -12,7 +12,7 @@ include_once "modules/backend.class"; function headlineRSS10_export($uri) { global $status, $HTTP_REFERER, $HTTP_USER_AGENT; - if ($uri[1] == "headlinesRSS10.rdf") { + if ($uri[2] == "headlinesRSS10.rdf") { watchdog("message", "grabbed 'headlinesRSS10.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT"); header("Content-Type: text/plain"); diff --git a/modules/locale.module b/modules/locale.module index da09f8fd6..5fd20b48e 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -65,7 +65,7 @@ function locale_languages($translation) { return $output; } -function locale_display() { +function locale_overview() { $result = db_query("SELECT * FROM locales ORDER BY string"); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; @@ -85,7 +85,7 @@ function locale_admin() { switch ($op) { case "delete": locale_delete(check_input($id)); - locale_display(); + locale_overview(); break; case "help": locale_help(); @@ -97,7 +97,7 @@ function locale_admin() { locale_save(check_input($id), $edit); // fall through default: - locale_display(); + locale_overview(); } } diff --git a/modules/locale/locale.module b/modules/locale/locale.module index da09f8fd6..5fd20b48e 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -65,7 +65,7 @@ function locale_languages($translation) { return $output; } -function locale_display() { +function locale_overview() { $result = db_query("SELECT * FROM locales ORDER BY string"); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>string</TH><TH>languages</TH><TH COLSPAN=\"2\">operations</TH><TR>\n"; @@ -85,7 +85,7 @@ function locale_admin() { switch ($op) { case "delete": locale_delete(check_input($id)); - locale_display(); + locale_overview(); break; case "help": locale_help(); @@ -97,7 +97,7 @@ function locale_admin() { locale_save(check_input($id), $edit); // fall through default: - locale_display(); + locale_overview(); } } diff --git a/modules/node.module b/modules/node.module index cbb0d5013..4c12ba5a7 100644 --- a/modules/node.module +++ b/modules/node.module @@ -11,7 +11,7 @@ function node_overview($query = array()) { $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($node = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp) ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -63,13 +63,14 @@ function node_delete($id) { function node_query($type = "") { global $status; - $queries = array(0 => array("active nodes", "ORDER BY n.timestamp DESC"), 1 => array("posted nodes", "WHERE n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued nodes", "WHERE n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped nodes", "WHERE n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent nodes", "ORDER BY n.timestamp DESC"), array("posted nodes", "WHERE n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued nodes", "WHERE n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped nodes", "WHERE n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function node_listing() { - foreach (node_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=node&type=$key\">$array[0]</A></LI>\n"; +function node_listing($queries) { + global $mod; + foreach ($queries as $key=>$array) { + $output .= "<LI><A HREF=\"admin.php?mod=$mod&type=$key\">$array[0]</A></LI>\n"; } return "<OL>$output</OL>\n"; } @@ -92,7 +93,7 @@ function node_admin() { print node_overview(); break; case "listing": - print node_listing(); + print node_listing(node_query()); break; case "Save node": print status(node_save($edit)); diff --git a/modules/node/node.module b/modules/node/node.module index cbb0d5013..4c12ba5a7 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -11,7 +11,7 @@ function node_overview($query = array()) { $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($node = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp) ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; } $output .= "</TABLE>\n"; @@ -63,13 +63,14 @@ function node_delete($id) { function node_query($type = "") { global $status; - $queries = array(0 => array("active nodes", "ORDER BY n.timestamp DESC"), 1 => array("posted nodes", "WHERE n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued nodes", "WHERE n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped nodes", "WHERE n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent nodes", "ORDER BY n.timestamp DESC"), array("posted nodes", "WHERE n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued nodes", "WHERE n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped nodes", "WHERE n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function node_listing() { - foreach (node_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=node&type=$key\">$array[0]</A></LI>\n"; +function node_listing($queries) { + global $mod; + foreach ($queries as $key=>$array) { + $output .= "<LI><A HREF=\"admin.php?mod=$mod&type=$key\">$array[0]</A></LI>\n"; } return "<OL>$output</OL>\n"; } @@ -92,7 +93,7 @@ function node_admin() { print node_overview(); break; case "listing": - print node_listing(); + print node_listing(node_query()); break; case "Save node": print status(node_save($edit)); diff --git a/modules/page.module b/modules/page.module index f004f59b1..1d712a9ba 100644 --- a/modules/page.module +++ b/modules/page.module @@ -56,14 +56,22 @@ function page_save($edit) { node_save(array_merge($edit, array(type => "page", status => $status[posted]))); } -function page_overview() { - return node_overview("type = 'page'"); +function page_query($type = "") { + global $status; + $queries = array(array("recent pages", "WHERE n.type = 'page' ORDER BY n.timestamp DESC"), array("posted pages", "WHERE n.type = 'page' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("dumped pages", "WHERE n.type = 'page' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + return ($queries[$type] ? $queries[$type] : $queries); +} + +function page_overview($query = array()) { + return node_overview($query); } function page_admin() { - global $id, $op, $edit; + global $id, $op, $edit, $type; - print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n"; + print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page&op=listing\">page listing</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n"; + + $type = ($type ? $type : 0); switch ($op) { case "add": @@ -72,11 +80,14 @@ function page_admin() { case "edit": print page_form(node_get_array(nid, $id)); break; + case "listing": + print node_listing(page_query()); + break; case "Save page": print status(page_save($edit)); // fall through: default: - print page_overview(); + print page_overview(page_query($type)); } } diff --git a/modules/page/page.module b/modules/page/page.module index f004f59b1..1d712a9ba 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -56,14 +56,22 @@ function page_save($edit) { node_save(array_merge($edit, array(type => "page", status => $status[posted]))); } -function page_overview() { - return node_overview("type = 'page'"); +function page_query($type = "") { + global $status; + $queries = array(array("recent pages", "WHERE n.type = 'page' ORDER BY n.timestamp DESC"), array("posted pages", "WHERE n.type = 'page' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("dumped pages", "WHERE n.type = 'page' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + return ($queries[$type] ? $queries[$type] : $queries); +} + +function page_overview($query = array()) { + return node_overview($query); } function page_admin() { - global $id, $op, $edit; + global $id, $op, $edit, $type; - print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n"; + print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page&op=listing\">page listing</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n"; + + $type = ($type ? $type : 0); switch ($op) { case "add": @@ -72,11 +80,14 @@ function page_admin() { case "edit": print page_form(node_get_array(nid, $id)); break; + case "listing": + print node_listing(page_query()); + break; case "Save page": print status(page_save($edit)); // fall through: default: - print page_overview(); + print page_overview(page_query($type)); } } diff --git a/modules/settings.module b/modules/settings.module index 1bbe64fdb..3cdb70233 100644 --- a/modules/settings.module +++ b/modules/settings.module @@ -3,7 +3,7 @@ $module = array("admin" => "settings_admin"); function settings_conf() { - global $conf, $cmodes, $corder; + global $conf, $cmodes, $corder, $themes; $output .= "<H3>General settings</H3>\n"; @@ -23,46 +23,53 @@ function settings_conf() { $output .= "<INPUT NAME=\"edit[anonymous]\" MAXLENGTH=\"55\" SIZE=\"30\" VALUE=\"". variable_get(anonymous, "Anonymous") ."\"><BR>\n"; $output .= "<I><SMALL>The name displayed for anonymous users.</SMALL></I><P>\n"; + $output .= "<B>Default theme:</B><BR>\n"; + foreach ($themes as $key=>$value) $options1 .= "<OPTION VALUE=\"$key\"". (variable_get(default_theme, key($themes)) == $key ? " SELECTED" : "") .">$key</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[default_theme]\">$options1</SELECT><BR>\n"; + $output .= "<I><SMALL>The default theme displayed for anonymous users.</SMALL></I><P>\n"; + $output .= "<HR>\n"; - $output .= "<H3>Comment system</H3>\n"; + $output .= "<H3>Comment settings</H3>\n"; $output .= "<B>Default display mode:</B><BR>\n"; - foreach ($cmodes as $key=>$value) $options1 .= "<OPTION VALUE=\"$key\"". ($conf[default_comment_mode] == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<SELECT NAME=\"edit[default_comment_mode]\">$options1</SELECT><BR>\n"; + foreach ($cmodes as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($conf[default_comment_mode] == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[default_comment_mode]\">$options2</SELECT><BR>\n"; $output .= "<I><SMALL>The default mode in which comments are displayed.</SMALL></I><P>\n"; $output .= "<B>Default display mode:</B><BR>\n"; - foreach ($corder as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($conf[default_comment_order] == $key ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<SELECT NAME=\"edit[default_comment_order]\">$options2</SELECT><BR>\n"; + foreach ($corder as $key=>$value) $options3 .= "<OPTION VALUE=\"$key\"". ($conf[default_comment_order] == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[default_comment_order]\">$options3</SELECT><BR>\n"; $output .= "<I><SMALL>The default mode in which comments are displayed.</SMALL></I><P>\n"; $output .= "<B>Default threshold:</B><BR>\n"; - for ($i = -1; $i < 6; $i++) $options3 .= " <OPTION VALUE=\"$i\"". ($conf[default_comment_threshold] == $i ? " SELECTED" : "") .">Filter - $i</OPTION>"; - $output .= "<SELECT NAME=\"edit[default_comment_threshold]\">$options3</SELECT><BR>\n"; + for ($i = -1; $i < 6; $i++) $options4 .= " <OPTION VALUE=\"$i\"". ($conf[default_comment_threshold] == $i ? " SELECTED" : "") .">Filter - $i</OPTION>"; + $output .= "<SELECT NAME=\"edit[default_comment_threshold]\">$options4</SELECT><BR>\n"; $output .= "<I><SMALL>The default threshold used to filter comments.</SMALL></I><P>\n"; $output .= "<HR>\n"; - $output .= "<H3>Submission system</H3>\n"; + $output .= "<H3>Submission settings</H3>\n"; $size = array(1000 => "1.000 characters", 5000 => "5.000 characters", 10000 => "10.000 characters", 15000 => "15.000 characters", 30.000 => "30.000 characters", 50000 => "50.000 characters", 100000 => "100.000 characters"); $output .= "<B>Maximum submission size:</B><BR>\n"; - foreach ($size as $key=>$value) $options4 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_input_size, 10000) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<SELECT NAME=\"edit[max_input_size]\">$options4</SELECT><BR>\n"; + foreach ($size as $key=>$value) $options5 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_input_size, 10000) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[max_input_size]\">$options5</SELECT><BR>\n"; $output .= "<I><SMALL>The maximum number of characters someone can enter in a form.</SMALL></I><P>\n"; $rate = array(1 => "maximum 1 every second", 5 => "maximum 1 every 5 seconds", 15 => "maximum 1 every 15 seconds", 30 => "maximum 1 every 30 seconds", 60 => "maximum 1 every minute", 300 => "maximum 1 every 5 minutes", 900 => "maximum 1 every 15 minutes", 1800 => "maximum 1 every 30 minutes", 3600 => "maximum 1 every hour", 21600 => "maximum 1 every 6 hour", 43200 => "maximum 1 every 12 hour"); $output .= "<B>Maximum node rate:</B><BR>\n"; - foreach ($rate as $key=>$value) $options5 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_node_rate, 900) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<SELECT NAME=\"edit[max_node_rate]\">$options5</SELECT><BR>\n"; + foreach ($rate as $key=>$value) $options6 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_node_rate, 900) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[max_node_rate]\">$options6</SELECT><BR>\n"; $output .= "<I><SMALL>The maximum submission rate for nodes. Its purpose is to stop potential abuse or denial of service attacks.</SMALL></I><P>\n"; $output .= "<B>Maximum comment rate:</B><BR>\n"; - foreach ($rate as $key=>$value) $options6 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_comment_rate, 120) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; - $output .= "<SELECT NAME=\"edit[max_comment_rate]\"$options6</SELECT><BR>\n"; + foreach ($rate as $key=>$value) $options7 .= " <OPTION VALUE=\"$key\"". ((variable_get(max_comment_rate, 120) == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; + $output .= "<SELECT NAME=\"edit[max_comment_rate]\"$options7</SELECT><BR>\n"; $output .= "<I><SMALL>The maximum submission rate for comments. Its purpose is to stop potential abuse or denial of service attacks.</SMALL></I><P>\n"; + $output .= "<HR>\n"; + return $output; } diff --git a/modules/story.module b/modules/story.module index 0a90490b6..852ed7053 100644 --- a/modules/story.module +++ b/modules/story.module @@ -201,18 +201,10 @@ function story_block() { function story_query($type = "") { global $status; - $queries = array(0 => array("active stories", "WHERE n.type = 'story' ORDER BY n.timestamp DESC"), 1 => array("posted stories", "WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued stories", "WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped stories", "WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent stories", "WHERE n.type = 'story' ORDER BY n.timestamp DESC"), array("posted stories", "WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued stories", "WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped stories", "WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function story_listing() { - foreach (story_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=story&type=$key\">$array[0]</A></LI>\n"; - } - return "<OL>$output</OL>\n"; -} - - function story_overview($query = array()) { return node_overview($query); } @@ -239,7 +231,7 @@ function story_admin() { story_help(); break; case "listing": - print story_listing(); + print node_listing(story_query()); break; case "search": print search_form($keys); diff --git a/modules/story/story.module b/modules/story/story.module index 0a90490b6..852ed7053 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -201,18 +201,10 @@ function story_block() { function story_query($type = "") { global $status; - $queries = array(0 => array("active stories", "WHERE n.type = 'story' ORDER BY n.timestamp DESC"), 1 => array("posted stories", "WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued stories", "WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped stories", "WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + $queries = array(array("recent stories", "WHERE n.type = 'story' ORDER BY n.timestamp DESC"), array("posted stories", "WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("queued stories", "WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY n.timestamp DESC"), array("dumped stories", "WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); return ($queries[$type] ? $queries[$type] : $queries); } -function story_listing() { - foreach (story_query() as $key=>$array) { - $output .= "<LI><A HREF=\"admin.php?mod=story&type=$key\">$array[0]</A></LI>\n"; - } - return "<OL>$output</OL>\n"; -} - - function story_overview($query = array()) { return node_overview($query); } @@ -239,7 +231,7 @@ function story_admin() { story_help(); break; case "listing": - print story_listing(); + print node_listing(story_query()); break; case "search": print search_form($keys); |