From f162723fe49114779940e1cb34903a15b23de566 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 25 Jan 2001 15:29:45 +0000 Subject: - fixed ieni-wienie small bug in comment.inc (reported by NotZen) --- includes/comment.inc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'includes') diff --git a/includes/comment.inc b/includes/comment.inc index 64f0c1000..6e39ee2ba 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -11,7 +11,7 @@ $corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high", 4 => " $link = ($mod) ? $mod : substr($PHP_SELF, 1, strlen($PHP_SELF) - 5); class Comment { - function Comment($userid, $subject, $comment, $timestamp, $url, $fake_email, $score, $votes, $cid) { + function Comment($userid, $subject, $comment, $timestamp, $url, $fake_email, $score, $votes, $cid, $lid) { $this->userid = $userid; $this->subject = $subject; $this->comment = $comment; @@ -21,6 +21,7 @@ class Comment { $this->score = $score; $this->votes = $votes; $this->cid = $cid; + $this->lid = $lid; } } @@ -58,7 +59,7 @@ function comment_reply($pid, $id) { // Extract parent-information/data: if ($pid) { $item = db_fetch_object(db_query("SELECT comments.*, users.userid FROM comments LEFT JOIN users ON comments.author = users.id WHERE comments.cid = $pid")); - $theme->comment(new Comment($item->userid, $item->subject, $item->comment, $item->timestamp, $item->url, $item->fake_email, comment_score($comment), $comment->votes, $item->cid), "reply to this comment"); + $theme->comment(new Comment($item->userid, $item->subject, $item->comment, $item->timestamp, $item->url, $item->fake_email, comment_score($comment), $comment->votes, $item->cid, $item->lid), "reply to this comment"); } else { $pid = 0; @@ -90,8 +91,8 @@ function comment_reply($pid, $id) { $output .= " Allowed HTML tags: ". htmlspecialchars($allowed_html) .".\n"; $output .= "

\n"; - // Preview button: - $output .= "

\n"; + // Preview button: + $output .= "

\n"; $output .= " You must preview at least once before you can submit:
\n"; $output .= " \n"; $output .= " \n"; @@ -107,7 +108,7 @@ function comment_preview($pid, $id, $subject, $comment) { global $allowed_html, $link, $theme, $user; // Preview comment: - $theme->comment(new Comment($user->userid, $subject, $comment, time(), $user->url, $user->fake_email, "", "", ""), "reply to this comment"); + $theme->comment(new Comment($user->userid, $subject, $comment, time(), $user->url, $user->fake_email, 0, 0, 0, 0), "reply to this comment"); // Build reply form: $output .= "

\n"; @@ -130,7 +131,7 @@ function comment_preview($pid, $id, $subject, $comment) { $output .= "
\n"; $output .= " Allowed HTML tags: ". htmlspecialchars($allowed_html) .".\n"; $output .= "

\n"; - + // Hidden fields: $output .= "\n"; $output .= "\n"; @@ -148,7 +149,7 @@ function comment_preview($pid, $id, $subject, $comment) { $output .= "
\n"; $output .= "

\n"; - $theme->box("Reply", $output); + $theme->box("Reply", $output); } function comment_post($pid, $id, $subject, $comment) { @@ -161,7 +162,7 @@ function comment_post($pid, $id, $subject, $comment) { watchdog("error", "comment: attempt to insert duplicate comment"); $theme->box("duplicate comment", "duplicate comment: $duplicate"); } - else { + else { // Validate subject: $subject = ($subject) ? $subject : substr($comment, 0, 29); @@ -170,7 +171,7 @@ function comment_post($pid, $id, $subject, $comment) { // Add comment to database: db_query("INSERT INTO comments (link, lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('". check_input($link) ."', $id, $pid, '$user->id', '". check_input($subject) ."', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->userid ? 1 : 0) ."')"); - + // Compose header: header("Location: ". comment_uri("id=$id")); } @@ -185,7 +186,7 @@ function comment_num_replies($id, $count = 0) { $result = db_query("SELECT COUNT(cid) FROM comments WHERE pid = $id"); return ($result) ? db_result($result, 0) : 0; } - + function comment_num_filtered($lid, $pid) { global $user; @@ -312,7 +313,7 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) { print "