summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2000-06-22 20:21:07 +0000
committerDries Buytaert <dries@buytaert.net>2000-06-22 20:21:07 +0000
commitde707b67970fd7e99ec6a70c67ce76309cfec0d5 (patch)
tree8197c13047a32809b260bbd637e3635fc460b4dc
parent3e4e873f211b94c15516a462ea30cdb0af4b6bdd (diff)
downloadbrdo-de707b67970fd7e99ec6a70c67ce76309cfec0d5.tar.gz
brdo-de707b67970fd7e99ec6a70c67ce76309cfec0d5.tar.bz2
* Various small bugfixes and enhancements: I think I fixed all bugs I
knew about. * The code generated by my theme `Dries' is now 90% of the time aligned correctly. :o)
-rw-r--r--article.php2
-rw-r--r--comments.php65
-rw-r--r--submit.php4
3 files changed, 19 insertions, 52 deletions
diff --git a/article.php b/article.php
index e18068d67..63c2277f4 100644
--- a/article.php
+++ b/article.php
@@ -16,6 +16,6 @@
$theme->header();
$theme->article($story, "[ <A HREF=\"\"><FONT COLOR=\"$theme->hlcolor2\">home</FONT></A> | <A HREF=\"comments.php?op=reply&pid=0&sid=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">add a comment</FONT></A> ]");
- if ($mode != "nocomments") include "comments.php";
+ include "comments.php";
$theme->footer();
?> \ No newline at end of file
diff --git a/comments.php b/comments.php
index 385bd3826..00c3edda2 100644
--- a/comments.php
+++ b/comments.php
@@ -1,6 +1,6 @@
<?
-function displayKids ($cid, $mode, $order = 0, $thold = 0, $level = 0, $dummy = 0) {
+function comments_kids ($cid, $mode, $order = 0, $thold = 0, $level = 0, $dummy = 0) {
global $user, $theme;
include "config.inc";
@@ -17,7 +17,7 @@ function displayKids ($cid, $mode, $order = 0, $thold = 0, $level = 0, $dummy =
$link = "<A HREF=\"comments.php?op=reply&pid=$comment->cid&sid=$comment->sid&mode=$mode&order=$order&thold=$thold\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
$theme->comment($comment->userid, $comment->subject, $comment->comment, $comment->timestamp, $comment->url, $comment->femail, $comment->score, $comment->cid, $link);
- displayKids($comment->cid, $mode, $order, $thold, $level + 1, $dummy + 1);
+ comments_kids($comment->cid, $mode, $order, $thold, $level + 1, $dummy + 1);
}
}
}
@@ -27,9 +27,13 @@ function displayKids ($cid, $mode, $order = 0, $thold = 0, $level = 0, $dummy =
$link = "<A HREF=\"comments.php?op=reply&pid=$comment->cid&sid=$comment->sid&mode=$mode&order=$order&thold=$thold\"><FONT COLOR=\"$theme->hlcolor2\">reply to this comment</FONT></A>";
$theme->comment($comment->userid, $comment->subject, $comment->comment, $comment->timestamp, $comment->url, $comment->femail, $comment->score, $comment->cid, $link);
}
- displayKids($comment->cid, $mode, $order, $thold);
+ comments_kids($comment->cid, $mode, $order, $thold);
}
- } else {
+ }
+ elseif ($mode == "disabled") {
+ // do nothing
+ }
+ else {
print "ERROR: we should not get here!";
}
@@ -38,7 +42,7 @@ function displayKids ($cid, $mode, $order = 0, $thold = 0, $level = 0, $dummy =
}
}
-function displayBabies($cid, $mode, $order, $thold, $level = 0, $thread) {
+function comments_childs($cid, $mode, $order, $thold, $level = 0, $thread) {
global $theme, $user;
### Perform SQL query:
@@ -62,7 +66,7 @@ function displayBabies($cid, $mode, $order, $thold, $level = 0, $thread) {
$thread .= "\">$comment->subject</A> by $comment->userid <SMALL>(". date("D, M d, Y - H:i:s", $comment->timestamp) .")<SMALL></LI>";
### Recursive:
- displayBabies($comment->cid, $mode, $order, $thold, $level + 1, &$thread);
+ comments_childs($comment->cid, $mode, $order, $thold, $level + 1, &$thread);
}
if ($level && $comments) {
@@ -101,20 +105,14 @@ function comments_display ($sid = 0, $pid = 0, $cid = 0, $mode = "threaded", $or
### Display the comments:
if ($mode == "threaded") {
- $thread = displayBabies($comment->cid, $mode, $order, $thold);
+ $thread = comments_childs($comment->cid, $mode, $order, $thold);
$theme->comment($comment->userid, $comment->subject, $comment->comment, $comment->timestamp, $comment->url, $comment->femail, $comment->score, $comment->cid, $link, $thread);
}
else {
$theme->comment($comment->userid, $comment->subject, $comment->comment, $comment->timestamp, $comment->url, $comment->femail, $comment->score, $comment->cid, $link);
- displayKids($comment->cid, $mode, $order, $thold, $level);
+ comments_kids($comment->cid, $mode, $order, $thold, $level);
}
-/*
- print "</UL>\n";
- print "</P>\n";
-*/
}
-
- if ($pid == 0) return array($sid, $pid, $subject);
}
function comments_reply($pid, $sid, $mode, $order, $thold) {
@@ -273,37 +271,12 @@ function comment_post($pid, $sid, $subject, $comment, $mode, $order, $thold) {
}
}
-function moderate($cid, $meta_value = 0) {
- include "config.inc";
- if ($meta_value != -1) {
- ### Compose query:
- $query = "UPDATE comments SET";
- if ($meta_value > (sizeof($comments_meta_reasons) / 2)) {
- $query .= " score = score + 1, reason = $meta_value WHERE cid = $cid";
- }
- elseif ($meta_value < ((sizeof($comments_meta_reasons) / 2) - 1)) {
- $query .= " score = score - 1, reason = $meta_value WHERE cid = $cid";
- }
- else {
- $query .= " reason = $meta_value WHERE cid = $cid";
- }
-
- ### Perform query:
- mysql_query("$query");
- }
-}
-
if (strstr($PHP_SELF, "comments.php")) {
include "theme.inc";
include "functions.inc";
}
switch($op) {
- case "reply":
- $theme->header();
- comments_reply($pid, $sid, $mode, $order, $thold);
- $theme->footer();
- break;
case "Preview comment":
$theme->header();
comment_preview($pid, $sid, $subject, $comment, $mode, $order, $thold);
@@ -312,16 +285,10 @@ switch($op) {
case "Post comment":
comment_post($pid, $sid, $subject, $comment, $mode, $order, $thold);
break;
- case "Moderate":
- while (list($name, $value) = each($HTTP_POST_VARS)) {
- if (eregi("meta", $name)) {
- ### extract comment id (cid):
- $info = explode(":", $name);
- moderate($info[1], $value);
- }
- }
-
- Header("Location: article.php?sid=$sid&mode=$mode&order=$order&thold=$thold");
+ case "reply":
+ $theme->header();
+ comments_reply($pid, $sid, $mode, $order, $thold);
+ $theme->footer();
break;
case "show":
$theme->header();
diff --git a/submit.php b/submit.php
index f77c908d2..87c369207 100644
--- a/submit.php
+++ b/submit.php
@@ -125,7 +125,7 @@ function submit_preview($subject, $abstract, $story, $category) {
$output .= "</FORM>\n";
$theme->header();
- $theme->preview("", $user->userid, date("l, F d, Y - H:i A", time()), stripslashes($subject), "we-hate-typoes", stripslashes($abstract), "", stripslashes($story));
+ $theme->preview($user->userid, stripslashes($subject), stripslashes($abstract), "", stripslashes($story), date("l, F d, Y - H:i A", time()), stripslashes($category), "we-hate-typoes");
$theme->box("Submit a story", $output);
$theme->footer();
}
@@ -137,7 +137,7 @@ function submit_submit($subject, $abstract, $article, $category) {
include "theme.inc";
### Add submission to SQL table:
- db_query("INSERT INTO stories (author, subject, abstract, article, category, timestamp) VALUES ('$user->id', '$subject', '$abstract', '$article', '$category', '". time() ."')");
+ db_query("INSERT INTO stories (author, subject, abstract, article, category, timestamp) VALUES ('$user->id', '". addslashes($subject) ."', '". addslashes($abstract) ."', '". addslashes($article) ."', '". addslashes($category) ."', '". time() ."')");
### Display confirmation message:
$theme->header();