summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database/database.mysql2
-rw-r--r--includes/comment.inc14
-rw-r--r--includes/node.inc8
-rw-r--r--includes/structure.inc12
-rw-r--r--includes/variable.inc9
-rw-r--r--index.php2
-rw-r--r--modules/book.module12
-rw-r--r--modules/book/book.module12
-rw-r--r--modules/moderation.module2
-rw-r--r--modules/node.module6
-rw-r--r--modules/node/node.module6
-rw-r--r--modules/page.module2
-rw-r--r--modules/page/page.module2
-rw-r--r--modules/story.module58
-rw-r--r--modules/story/story.module58
-rw-r--r--modules/structure.module2
-rw-r--r--node.php57
-rw-r--r--themes/example/example.theme15
-rw-r--r--themes/goofy/goofy.theme10
-rw-r--r--themes/marvin/marvin.theme43
-rw-r--r--themes/unconed/unconed.theme14
-rw-r--r--themes/yaroon/jeroen2.theme8
22 files changed, 147 insertions, 207 deletions
diff --git a/database/database.mysql b/database/database.mysql
index c765d0277..c3d577758 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -2,7 +2,7 @@
#
# Host: localhost Database: drop
#--------------------------------------------------------
-# Server version 3.22.32
+# Server version 3.22.32
#
# Table structure for table 'access'
diff --git a/includes/comment.inc b/includes/comment.inc
index 1a25c11c2..0d1003530 100644
--- a/includes/comment.inc
+++ b/includes/comment.inc
@@ -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;
}
diff --git a/includes/node.inc b/includes/node.inc
index 9fc42a120..9a8b9f020 100644
--- a/includes/node.inc
+++ b/includes/node.inc
@@ -6,7 +6,7 @@ $rstatus = array(0 => dumped, 1 => expired, 2 => queued, 3 => posted);
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) {
diff --git a/includes/structure.inc b/includes/structure.inc
index 4326e092e..ff05b36d2 100644
--- a/includes/structure.inc
+++ b/includes/structure.inc
@@ -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) {
diff --git a/includes/variable.inc b/includes/variable.inc
index 083f7d492..fa389e511 100644
--- a/includes/variable.inc
+++ b/includes/variable.inc
@@ -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) {
diff --git a/index.php b/index.php
index 123548110..51b78e374 100644
--- a/index.php
+++ b/index.php
@@ -8,7 +8,7 @@ $result = db_query("SELECT nid FROM node WHERE type = 'story' AND status = '$sta
$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();
diff --git a/modules/book.module b/modules/book.module
index 1924072ec..1f483b94c 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -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"):
diff --git a/modules/book/book.module b/modules/book/book.module
index 1924072ec..1f483b94c 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -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"):
diff --git a/modules/moderation.module b/modules/moderation.module
index 75a6df1b8..4c447d282 100644
--- a/modules/moderation.module
+++ b/modules/moderation.module
@@ -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();
}
diff --git a/modules/node.module b/modules/node.module
index 4c12ba5a7..7d0a5b3a5 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -5,13 +5,13 @@ $module = array("admin" => "node_admin");
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";
diff --git a/modules/node/node.module b/modules/node/node.module
index 4c12ba5a7..7d0a5b3a5 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -5,13 +5,13 @@ $module = array("admin" => "node_admin");
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";
diff --git a/modules/page.module b/modules/page.module
index 08d5c6946..b5d0f86cf 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -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]) {
diff --git a/modules/page/page.module b/modules/page/page.module
index 08d5c6946..b5d0f86cf 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -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]) {
diff --git a/modules/story.module b/modules/story.module
index feb65cc32..484574d35 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -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"):
diff --git a/modules/story/story.module b/modules/story/story.module
index feb65cc32..484574d35 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -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"):
diff --git a/modules/structure.module b/modules/structure.module
index 35e7cbf5a..6e921ec0d 100644
--- a/modules/structure.module
+++ b/modules/structure.module
@@ -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) {
diff --git a/node.php b/node.php
index 05c4bfec8..02e5c4c1d 100644
--- a/node.php
+++ b/node.php
@@ -4,6 +4,61 @@ include "includes/common.inc";
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 @@ elseif ($number) {
break;
default:
user_rehash();
- node_view($node, 1);
+ node_render($node);
}
}
else {
diff --git a/themes/example/example.theme b/themes/example/example.theme
index 9d5cbd250..8b7d608c8 100644
--- a/themes/example/example.theme
+++ b/themes/example/example.theme
@@ -47,7 +47,7 @@
} // 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 @@
</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>
diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme
index 8acde2ae8..69b988730 100644
--- a/themes/goofy/goofy.theme
+++ b/themes/goofy/goofy.theme
@@ -88,7 +88,7 @@
<?php
}
- function story($story, $reply = 0) {
+ function story($story, $main = 0) {
echo "\n<!-- story: \"$story->title\" -->\n";
?>
@@ -117,7 +117,7 @@
<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 @@
<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>
diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme
index 41c4e318c..584720919 100644
--- a/themes/marvin/marvin.theme
+++ b/themes/marvin/marvin.theme
@@ -44,28 +44,27 @@
<?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 = "") {
diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme
index 5556c6bf0..ed3a1b952 100644
--- a/themes/unconed/unconed.theme
+++ b/themes/unconed/unconed.theme
@@ -78,7 +78,7 @@
<?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 @@
<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 @@
<TD BGCOLOR="<?php echo $this->bgcolor2 ?>" COLSPAN="2">
<?php
echo "<P>". check_output($story->abstract, 1) ."</P>";
- if ($reply)
- if ($story->body) print "<P>". check_output($story->body, 1) ."</P>\n";
+ if (!$main && $story->body) print "<P>". check_output($story->body, 1) ."</P>\n";
?>
</TD>
</TR>
<?php
- if (!$reply)
+ if ($main)
echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". theme_morelink($this, $story) ."</TD></TR>";
- else
- echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD COLSPAN=\"2\" BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\">". $reply ."</TD></TR>";
?>
</TABLE></TD></TR></TABLE><BR>
<?php
diff --git a/themes/yaroon/jeroen2.theme b/themes/yaroon/jeroen2.theme
index 06434db50..b4d4e6be0 100644
--- a/themes/yaroon/jeroen2.theme
+++ b/themes/yaroon/jeroen2.theme
@@ -106,7 +106,7 @@
} // close header function
- function story($story, $reply = 0) {
+ function story($story, $main = 0) {
switch ($story->tid) {
case 0: $color = "#c4a2a2"; $img = "square2.gif"; break;
@@ -135,17 +135,15 @@
<?php
echo "<br />". check_output($story->abstract, 1) ."<br />";
- if ($reply && $story->body)
+ if (!$main && $story->body)
echo "<br />". check_output($story->body, 1) ."<br />";
echo" </td>
</tr>
<tr>
<td align=\"right\">
<font color=\"". $color ."\">";
- if (!$reply)
+ if ($main)
echo "". theme_morelink($this, $story) ."";
- else
- echo "". $reply ."";
echo"</font>";
?>