Commit b1c66cb5 authored by Dries's avatar Dries

Another big update so please read this carefully because there is important...

Another big update so please read this carefully because there is important information hidden in it.

Made it so that we can disable/enable comments on a category by category basis. In order to accomplish this I had to make a few (*temporary*) changes.

I moved all comment code from the "module level" (eg. story.module) to the "node level".  It was nothing but the logical next step in nodifying drupal.  This enables us to add comments to all existing content types including book entries.  But also for book entries, this to can be toggled on and off. :-)

Moreover module writers don't have to worry about the complex comment logic: it is "abstracted" away.  This implies that story.module got smaller, faster and easier to comprehend. :-)

In order to accomplish this, I had to update ALL THEMES, which I did - and on my way I updated Goofy, Oranzh and UnConeD - with the previous changes.  All themes are up-to-date now!  I also had to remove the [ reply to this story ] links, and temporally re-introcuded the "Add comment" button in the "Comment control".  Tempora lly that is, UnConeD. ;)

I plan to upgrade drop.org either tommorow or wednesday so test away if you have some time to kill. ;)

Oh, I also fixed a few bugs and made various small improvements.
parent 2f898ebc
......@@ -2,7 +2,7 @@
#
# Host: localhost Database: drop
#--------------------------------------------------------
# Server version 3.22.32
# Server version 3.22.32
#
# Table structure for table 'access'
......
......@@ -32,10 +32,10 @@ function comment_moderate($moderate) {
foreach ($moderate as $id=>$vote) {
if ($vote != $comment_votes[$none] && !user_get($user, "history", "c$id")) {
// Update the comment's score:
// update the comment's score:
$result = db_query("UPDATE comments SET score = score ". check_input($vote) .", votes = votes + 1 WHERE cid = '". check_input($id) ."'");
// Update the user's history:
// update the user's history:
$user = user_set($user, "history", "c$id", $vote);
}
}
......@@ -124,22 +124,23 @@ function comment_preview($pid, $id, $subject, $comment) {
function comment_post($pid, $id, $subject, $comment) {
global $theme, $user;
// check comment submission rate:
throttle("post comment", variable_get(max_comment_rate, 60));
// Check for duplicate comments:
// check for duplicate comments:
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '$pid' AND lid = '$id' AND subject = '$subject' AND comment = '$comment'"), 0);
if ($duplicate != 0) {
watchdog("warning", "comment: duplicate '$subject'");
}
else {
// Validate subject:
// validate subject:
$subject = ($subject) ? $subject : substr($comment, 0, 29);
// Add watchdog entry:
// add watchdog entry:
watchdog("special", "comment: added '$subject'");
// Add comment to database:
// add comment to database:
db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('$id', '$pid', '$user->id', '$subject', '$comment', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->userid ? 1 : 0) ."')");
}
}
......@@ -191,6 +192,7 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1) {
$output .= comment_order(($user->id ? $user->sort : $order));
$output .= comment_threshold(($user->id ? $user->threshold : $threshold));
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Update settings") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Add comment") ."\">\n";
$output .= "</FORM>\n";
return $output;
}
......
......@@ -6,7 +6,7 @@
function _node_get($field, $value) {
$result = db_query("SELECT lid, type FROM node WHERE $field = '$value'");
if ($node = db_fetch_object($result)) {
return db_query("SELECT n.*, l.*, c.name AS category, t.name AS topic, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid LEFT JOIN topic t ON n.tid = t.tid WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
return db_query("SELECT n.*, l.*, c.name AS category, c.comment, t.name AS topic, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid LEFT JOIN topic t ON n.tid = t.tid WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
}
}
......@@ -131,11 +131,11 @@ function node_save($node) {
function node_invoke($node, $name, $arg = 0) {
if ($node[type]) $function = $node[type] ."_$name";
if ($node->type) $function = $node->type ."_$name";
if ($function) return ($arg ? $function($node) : $function($node, $arg));
if ($function) return ($arg ? $function($node, $arg) : $function($node));
}
function node_view($node, $page = 0) {
return node_invoke($node, "view", $page);
function node_view($node, $main = 0) {
return node_invoke($node, "view", $main);
}
function node_form($node) {
......
......@@ -28,19 +28,19 @@ function category_del($cid) {
db_query("UPDATE node SET cid = 0 WHERE cid = '". check_input($cid) ."'");
}
function category_post_threshold($cid, $default) {
function category_post_threshold($cid) {
$category = db_fetch_object(db_query("SELECT post AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
return $category->threshold ? $category->threshold : $default;
return $category->threshold;
}
function category_dump_threshold($cid, $default) {
function category_dump_threshold($cid) {
$category = db_fetch_object(db_query("SELECT dump AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
return $category->threshold ? $category->threshold : $default;
return $category->threshold;
}
function category_expire_threshold($cid, $default) {
function category_expire_threshold($cid) {
$category = db_fetch_object(db_query("SELECT expire AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
return $category->threshold ? $category->threshold : $default;
return $category->threshold;
}
function category_form_select($type, $edit = array(), $size = 1) {
......
......@@ -7,15 +7,18 @@ function variable_init($conf = array()) {
}
function handler_post_threshold($node, $default) {
return ($threshold = category_post_threshold($node->cid) ? $threshold : $default);
$threshold = category_post_threshold($node->cid);
return $threshold ? $threshold : $default;
}
function handler_dump_threshold($node, $default) {
return ($threshold = category_dump_threshold($node->cid) ? $threshold : $default);
$threshold = category_dump_threshold($node->cid);
return $threshold ? $threshold : $default;
}
function handler_expire_threshold($node, $default) {
return ($threshold = category_expire_threshold($node->cid) ? $threshold : $default);
$threshold = category_expire_threshold($node->cid);
return $threshold ? $threshold : $default;
}
function variable_get($name, $default, $object = 0) {
......
......@@ -8,7 +8,7 @@
$theme->header();
while ($node = db_fetch_object($result)) {
node_view(node_get_object("nid", $node->nid));
node_view(node_get_object("nid", $node->nid), 1);
}
$theme->footer();
......
......@@ -36,7 +36,7 @@ function book_type() {
return array("book", t("book page"));
}
function book_view($node, $page = 1) {
function book_view($node, $main = 0) {
global $theme;
if ($node->nid && $node->parent) {
......@@ -67,9 +67,7 @@ function book_view($node, $page = 1) {
$output .= " <TR><TD ALIGN=\"left\" WIDTH=\"33%\">". ($prev ? "<SMALL>". check_output($prev->title) ."</SMALL>" : "&nbsp;") ."</TD><TD ALIGN=\"center\" WIDTH=\"34%\">". ($node->parent ? "<A HREF=\"node.php?id=$node->parent\">". t("up") ."</A>" : t("up")) ."</TD><TD ALIGN=\"right\" WIDTH=\"33%\">". ($next ? "<SMALL>". check_output($next->title) ."</SMALL>" : "&nbsp;") ."</TD></TR>\n";
$output .= "</TABLE>\n";
if ($page) $theme->header();
$theme->box(t("Book"), $output);
if ($page) $theme->footer();
$theme->box(t("Handbook"), $output);
}
function book_find($keys) {
......@@ -211,7 +209,7 @@ function book_admin() {
print book_tree();
break;
case t("Preview"):
book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0);
book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
print book_form($edit);
break;
case t("Submit"):
......@@ -232,7 +230,7 @@ function book_page() {
}
$theme->header();
$theme->box(t("Book"), "<DL>$output</DL>");
$theme->box(t("Handbook"), "<DL>$output</DL>");
$theme->footer();
}
......@@ -262,7 +260,7 @@ function book_user() {
$theme->box($title, book_update($id));
break;
case t("Preview"):
book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0);
book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
$theme->box($title, book_form($edit));
break;
case t("Submit"):
......
......@@ -36,7 +36,7 @@ function book_type() {
return array("book", t("book page"));
}
function book_view($node, $page = 1) {
function book_view($node, $main = 0) {
global $theme;
if ($node->nid && $node->parent) {
......@@ -67,9 +67,7 @@ function book_view($node, $page = 1) {
$output .= " <TR><TD ALIGN=\"left\" WIDTH=\"33%\">". ($prev ? "<SMALL>". check_output($prev->title) ."</SMALL>" : "&nbsp;") ."</TD><TD ALIGN=\"center\" WIDTH=\"34%\">". ($node->parent ? "<A HREF=\"node.php?id=$node->parent\">". t("up") ."</A>" : t("up")) ."</TD><TD ALIGN=\"right\" WIDTH=\"33%\">". ($next ? "<SMALL>". check_output($next->title) ."</SMALL>" : "&nbsp;") ."</TD></TR>\n";
$output .= "</TABLE>\n";
if ($page) $theme->header();
$theme->box(t("Book"), $output);
if ($page) $theme->footer();
$theme->box(t("Handbook"), $output);
}
function book_find($keys) {
......@@ -211,7 +209,7 @@ function book_admin() {
print book_tree();
break;
case t("Preview"):
book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0);
book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
print book_form($edit);
break;
case t("Submit"):
......@@ -232,7 +230,7 @@ function book_page() {
}
$theme->header();
$theme->box(t("Book"), "<DL>$output</DL>");
$theme->box(t("Handbook"), "<DL>$output</DL>");
$theme->footer();
}
......@@ -262,7 +260,7 @@ function book_user() {
$theme->box($title, book_update($id));
break;
case t("Preview"):
book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0);
book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
$theme->box($title, book_form($edit));
break;
case t("Submit"):
......
......@@ -99,7 +99,7 @@ function moderation_node($id) {
$output .= "</FORM>\n";
$theme->header();
node_view($node, 0);
node_view($node);
$theme->box(t("Moderate"), $output);
$theme->footer();
}
......
......@@ -5,13 +5,13 @@
function node_overview($query = array()) {
global $user, $rstatus;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id $query[1] LIMIT 50");
$result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50");
$output .= status($query[0]);
$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";
$output .= " <TR><TH>title</TH><TH>category</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, "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 .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $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";
......
......@@ -5,13 +5,13 @@
function node_overview($query = array()) {
global $user, $rstatus;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id $query[1] LIMIT 50");
$result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50");
$output .= status($query[0]);
$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";
$output .= " <TR><TH>title</TH><TH>category</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, "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 .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $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";
......
......@@ -10,7 +10,7 @@ function page_type() {
return array("page", "static page");
}
function page_view($node) {
function page_view($node, $main = 0) {
global $format, $theme;
switch ($format[$node->format]) {
......
......@@ -10,7 +10,7 @@ function page_type() {
return array("page", "static page");
}
function page_view($node) {
function page_view($node, $main = 0) {
global $format, $theme;
switch ($format[$node->format]) {
......
......@@ -47,57 +47,9 @@ function story_type() {
return array("story", t("story"));
}
function story_view($node, $page = 1) {
global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF;
if ($page == 1) {
switch($op) {
case t("Preview comment"):
$theme->header();
comment_preview(check_input($pid), check_input($id), $subject, $comment);
$theme->footer();
break;
case t("Post comment"):
comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
comment_reply(check_input($pid), check_input($id));
$theme->footer();
break;
case t("Update settings"):
comment_settings(check_input($mode), check_input($order), check_input($threshold));
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case t("Moderate comments"):
comment_moderate($moderate);
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
comment_reply(check_input($pid), check_input($id));
$theme->footer();
break;
default:
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
}
}
else {
$theme->story($node, ($PHP_SELF == "/node.php" ? "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]" : 0));
}
function story_view($node, $main = 0) {
global $theme;
$theme->story($node, $main);
}
function story_form($edit = array()) {
......@@ -226,7 +178,7 @@ function story_admin() {
print search_data($keys, $mod);
break;
case t("Preview"):
story_view(new Story($edit),0);
story_view(new Story($edit));
print story_form($edit);
break;
case t("Submit"):
......@@ -243,7 +195,7 @@ function story_user() {
switch($op) {
case t("Preview"):
story_view(new Story($edit), 0);
story_view(new Story($edit));
$theme->box(t("Submit"), story_form($edit));
break;
case t("Submit"):
......
......@@ -47,57 +47,9 @@ function story_type() {
return array("story", t("story"));
}
function story_view($node, $page = 1) {
global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF;
if ($page == 1) {
switch($op) {
case t("Preview comment"):
$theme->header();
comment_preview(check_input($pid), check_input($id), $subject, $comment);
$theme->footer();
break;
case t("Post comment"):
comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
comment_reply(check_input($pid), check_input($id));
$theme->footer();
break;
case t("Update settings"):
comment_settings(check_input($mode), check_input($order), check_input($threshold));
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case t("Moderate comments"):
comment_moderate($moderate);
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
break;
case "reply":
$theme->header();
comment_reply(check_input($pid), check_input($id));
$theme->footer();
break;
default:
$theme->header();
$theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]");
comment_render($id, $cid);
$theme->footer();
}
}
else {
$theme->story($node, ($PHP_SELF == "/node.php" ? "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]" : 0));
}
function story_view($node, $main = 0) {
global $theme;
$theme->story($node, $main);
}
function story_form($edit = array()) {
......@@ -226,7 +178,7 @@ function story_admin() {
print search_data($keys, $mod);
break;
case t("Preview"):
story_view(new Story($edit),0);
story_view(new Story($edit));
print story_form($edit);
break;
case t("Submit"):
......@@ -243,7 +195,7 @@ function story_user() {
switch($op) {
case t("Preview"):
story_view(new Story($edit), 0);
story_view(new Story($edit));
$theme->box(t("Submit"), story_form($edit));
break;
case t("Submit"):
......
......@@ -2,7 +2,7 @@
$module = array("admin" => "structure_admin");
$cstatus = array("disabled", "enabled: incl. anonymous", "enabled: excl. anonymous");
$cstatus = array("disabled", "enabled");
$mstatus = array("post new submissions", "moderate new submissions");
function content_types($name, $module) {
......
......@@ -4,6 +4,61 @@
if (variable_get(dev_timing, 0)) timer_start();
function node_render($node) {
global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF;
if ($node->comment) {
switch($op) {
case t("Preview comment"):
$theme->header();
comment_preview(check_input($pid), check_input($id), $subject, $comment);
$theme->footer();
break;
case t("Post comment"):
comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
$theme->header();
node_view($node);
comment_render($id, $cid);
$theme->footer();
break;
case t("Add comment"):
$theme->header();
comment_reply(check_input($cid), check_input($id));
$theme->footer();
break;
case "reply":
$theme->header();
comment_reply(check_input($pid), check_input($id));
$theme->footer();
break;
case t("Update settings"):
comment_settings(check_input($mode), check_input($order), check_input($threshold));
$theme->header();
node_view($node);
comment_render($id, $cid);
$theme->footer();
break;
case t("Moderate comments"):
comment_moderate($moderate);
$theme->header();
node_view($node);
comment_render($id, $cid);
$theme->footer();
break;
default:
$theme->header();
node_view($node);
comment_render($id, $cid);
$theme->footer();
}
}
else {
$theme->header();
node_view($node);
$theme->footer();
}
}
function node_failure() {
global $theme;
$theme->header();
......@@ -48,7 +103,7 @@ function node_history($node) {
break;
default:
user_rehash();
node_view($node, 1);
node_render($node);
}
}
else {
......
......@@ -47,7 +47,7 @@ function header() {
} // close header function
function story($story, $reply = 0) {
function story($story, $main = 0) {
?>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="3" WIDTH="100%">
......@@ -74,27 +74,18 @@ function story($story, $reply = 0) {
</TR>
<TR>
<TD COLSPAN="2">
<?php
echo "<P>". check_output($story->abstract, 1) ."</P>";
if ($reply && $story->body)
if (!$main && $story->body)
echo "<P>". check_output($story->body, 1) ."</P>";
?>
</TD>
</TR>
<TR>
<TD COLSPAN="2">
<?php
if (!$reply)
if ($main)
echo theme_morelink($this, $story);
else
echo $reply;
?>
</TD>
......
......@@ -88,7 +88,7 @@ function linksbar() {
<?php
}
function story($story, $reply = 0) {
function story($story, $main = 0) {
echo "\n<!-- story: \"$story->title\" -->\n";
?>
......@@ -117,7 +117,7 @@ function story($story, $reply = 0) {
<tr>
<td class="lgl"><img src="themes/goofy/images/null.gif" alt=""></td>
<td class="lgcnt"><small><?php echo strtr(t("$how by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?></small></td>
<td class="lgcnt" nowrap><div align="right"><?php echo "<A HREF=\"search.php?category=". urlencode($story->section) ."\">". check_output($story->section) ."</A>"; ?></div></td>
<td class="lgcnt" nowrap><div align="right"><?php echo "<A HREF=\"index.php?category=$story->cid\">". check_output($story->category) ."</A> / <A HREF=\"index.php?topic=$story->tid\">". check_output($story->topic) ."</A>"; ?></div></td>
<td class="lgr"><img src="themes/goofy/images/null.gif" alt=""></td>
</tr>
<tr>
......@@ -125,15 +125,13 @@ function story($story, $reply = 0) {
<td class="lgcnt" width="100%" colspan="2"><hr color="#404040" size="1">
<?php
echo check_output($story->abstract, 1) . "<br>";
if ($reply && $story->body)
if (!$main && $story->body)
echo "<br>" . check_output($story->body, 1);
?>
<hr color="#404040" size="1"><div align="right">
<?php
if (!$reply)
if ($main)
echo theme_morelink($this, $story);
else
echo $reply;
?></div></td>
<td class="lgr"><img src="themes/goofy/images/null.gif" alt=""></td>
</tr>
......
......@@ -44,28 +44,27 @@ function header() {
<?php
}
function story($story, $reply = 0) {
print "\n<!-- story: \"$story->title\" -->\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=\"\"> &nbsp; <B>". check_output($story->title) ."</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";
print " <FONT COLOR=\"#7C7C7C\"><SMALL>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?><?php print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"index.php?category=$story->cid\"><FONT COLOR=\"#83997A\">". check_output($story->category) ."</FONT></A> / <A HREF=\"index.php?topic=$story->tid\"><FONT COLOR=\"#83997A\">". check_output($story->topic) ."</FONT></A></SMALL>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
print " <TR>\n";
print " <TD COLSPAN=\"2\">\n";
if ($story->abstract) print "<P>". check_output($story->abstract, 1) ."</P>\n";
if ($reply) if ($story->body) print " <P>". check_output($story->body, 1) ."</P>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
if (!$reply) print " <TR><TD COLSPAN=\"2\">". theme_morelink($this, $story) ."</TD></TR>\n";
else print " <TR><TD ALIGN=\"right\" COLSPAN=\"2\">". $reply ."</TD></TR>\n";
print "</TABLE>\n";
print "<BR><BR>\n\n";
function story($story, $main = 0) {
print "\n<!-- story: \"$story->title\" -->\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=\"\"> &nbsp; <B>". check_output($story->title) ."</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";
print " <FONT COLOR=\"#7C7C7C\"><SMALL>". strtr(t("Submitted by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?><?php print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"index.php?category=$story->cid\"><FONT COLOR=\"#83997A\">". check_output($story->category) ."</FONT></A> / <A HREF=\"index.php?topic=$story->tid\"><FONT COLOR=\"#83997A\">". check_output($story->topic) ."</FONT></A></SMALL>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
print " <TR>\n";
print " <TD COLSPAN=\"2\">\n";
if ($story->abstract) print "<P>". check_output($story->abstract, 1) ."</P>\n";
if (!$main && $story->body) print " <P>". check_output($story->body, 1) ."</P>\n";
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
if ($main) print " <TR><TD COLSPAN=\"2\">". theme_morelink($this, $story) ."</TD></TR>\n";
print "</TABLE>\n";
print "<BR><BR>\n\n";
}
function comment($comment, $link = "") {
......
......@@ -78,7 +78,7 @@ function header() {
<?php
}
function story($story, $reply = 0) {
function story($story, $main = 0) {
$timestamp = format_date($story->timestamp);
print "\n<!-- story: \"$story->title\" -->\n";
......@@ -89,10 +89,7 @@ function story($story, $reply = 0) {
<TR><TD COLSPAN="2" BGCOLOR="<?php echo $this->bgcolor1; ?>" WIDTH="100%"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><FONT COLOR="<?php echo $this->fgcolor1; ?>"><B><?php echo "". check_output($story->title) .""; ?></B></FONT></td><td valign="middle" align="center"><IMG SRC="themes/<?php print $this->themename; ?>/images/icon.gif" valign="middle"></td></tr></table></TD></TR>
<TR BGCOLOR="<?php echo $this->bgcolor2; ?>">
<?php
if ($story->section) { print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\">"; }
else { print "<TD COLSPAN=\"2\" BGCOLOR=\"$this->bgcolor2\">"; }
print "<SMALL>Posted by " . format_username($story->userid) . " on $timestamp";
if ($story->section) { print "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\"><B><A HREF=\"index.php?section=" . urlencode($story->section) . "\"><FONT COLOR=\"$this->sectioncolor\">". check_output($story->section) ."</FONT></A></B>"; }
print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>Posted by " . format_username($story->userid) . " on $timestamp</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\"><B><A HREF=\"index.php?category=$story->cid\"><FONT COLOR=\"$this->sectioncolor\">". check_output($story->category) ."</FONT></A> / <A HREF=\"index.php?topic=$story->tid\"><FONT COLOR=\"$this->sectioncolor\">". check_output($story->topic) ."</FONT></A></B>";
?>
</TD>
</TR>
......@@ -100,16 +97,13 @@ function story($story, $reply = 0) {
<TD BGCOLOR="<?php echo $this->bgcolor2 ?>" COLSPAN="2">