Commit 4711869f authored by Dries's avatar Dries

- 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.
parent dc93ff32
......@@ -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");
......
......@@ -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();
}
......
......@@ -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);
}
}
?>
......@@ -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);
}
}
?>
......@@ -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");
......
......@@ -12,7 +12,7 @@
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");
......
......@@ -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();
}
}
......
......@@ -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();
}
}
......
......@@ -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));
......
......@@ -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));
......
......@@ -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));
}
}
......
......@@ -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));
}
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
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