diff --git a/account.php b/account.php index 08af23bee4a2..3018e3a6a343 100644 --- a/account.php +++ b/account.php @@ -136,45 +136,39 @@ function account_user_save($edit) { } function account_site_edit() { - global $theme, $themes, $user; + global $cmodes, $corder, $theme, $themes, $user; if ($user->id) { $output .= "
\n"; $output .= "Theme:
\n"; - foreach ($themes as $key=>$value) { $options1 .= " \n"; } - $output .= "
\n"; $output .= "Selecting a different theme will change the look and feel of the site.

\n"; $output .= "Timezone:
\n"; - $date = time() - date("Z"); for ($zone = -43200; $zone <= 46800; $zone += 3600) { $options2 .= " \n"; } - $output .= "
\n"; $output .= "Select what time you currently have and your timezone settings will be set appropriate.

\n"; $output .= "Maximum number of stories:
\n"; - for ($stories = 10; $stories <= 30; $stories += 5) { $options3 .= "\n"; } - $output .= "
\n"; $output .= "The maximum number of stories that will be displayed on the main page.

\n"; - $options = ""; - $options .= ""; - $options .= ""; + foreach ($cmodes as $key=>$value) { + $options4 .= "\n"; + } $output .= "Comment display mode:
\n"; - $output .= "

\n"; - $options = ""; - $options .= ""; - $options .= ""; + $output .= "

\n"; + foreach ($corder as $key=>$value) { + $options5 .= "\n"; + } $output .= "Comment sort order:
\n"; - $output .= "

\n"; + $output .= "

\n"; $options = ""; $options .= ""; $options .= ""; @@ -185,8 +179,6 @@ function account_site_edit() { $output .= "Comment threshold:
\n"; $output .= "
\n"; $output .= "Comments that scored less than this setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.

\n"; - - $output .= "
\n"; $output .= "

\n"; @@ -289,12 +281,12 @@ function account_user($uname) { $block1 .= " Bio:". format_data($account->bio) ."\n"; $block1 .= "\n"; - $result = db_query("SELECT c.cid, c.pid, c.sid, c.subject, c.timestamp, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.sid WHERE u.userid = '$uname' AND s.status = 2 AND s.timestamp > ". (time() - 1209600) ." ORDER BY cid DESC LIMIT 10"); + $result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE u.userid = '$uname' AND s.status = 2 c.link = 'story' AND s.timestamp > ". (time() - 1209600) ." ORDER BY cid DESC LIMIT 10"); while ($comment = db_fetch_object($result)) { $block2 .= "\n"; - $block2 .= " \n"; + $block2 .= " \n"; $block2 .= " \n"; - $block2 .= " \n"; + $block2 .= " \n"; $block2 .= "
Comment:sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
Comment:lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
Date:". format_date($comment->timestamp) ."
Story:sid\">". check_output($comment->story) ."
Story:lid\">". check_output($comment->story) ."
\n"; $block2 .= "

\n"; $comments++; @@ -441,15 +433,15 @@ function account_track_comments() { $msg = "

This page might be helpful in case you want to keep track of your recent comments in any of the current discussions. You are presented an overview of your comments in each of the stories you participated in along with the number of replies each comment got.\n

\n"; - $sresult = db_query("SELECT s.id, s.subject, COUNT(s.id) as count FROM comments c LEFT JOIN stories s ON c.sid = s.id WHERE c.author = $user->id GROUP BY s.id DESC LIMIT 5"); + $sresult = db_query("SELECT s.id, s.subject, COUNT(s.id) as count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE c.author = $user->id GROUP BY s.id DESC LIMIT 5"); while ($story = db_fetch_object($sresult)) { - $output .= "

  • ". format_plural($story->count, comment, comments) ." attached to story `id\">". check_output($story->subject) ."`:
  • \n"; + $output .= "
  • ". format_plural($story->count, comment, comments) ." attached to story `id\">". check_output($story->subject) ."`:
  • \n"; $output .= " \n"; } @@ -466,11 +458,11 @@ function account_track_stories() { $msg = "

    This page might be helpful in case you want to keep track of the stories you contributed. You are presented an overview of your stories along with the number of replies each story got.\n

    \n"; - $result = db_query("SELECT s.id, s.subject, s.timestamp, s.category, COUNT(c.cid) as count FROM stories s LEFT JOIN comments c ON c.sid = s.id WHERE s.status = 2 AND s.author = $user->id GROUP BY s.id DESC"); + $result = db_query("SELECT s.id, s.subject, s.timestamp, s.category, COUNT(c.cid) as count FROM stories s LEFT JOIN comments c ON c.lid = s.id WHERE s.status = 2 AND s.author = $user->id GROUP BY s.id DESC"); while ($story = db_fetch_object($result)) { $output .= "\n"; - $output .= " \n"; + $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= "
    Subject:id\">". check_output($story->subject) ." (". format_plural($story->count, "comment", "comments") .")
    Subject:id\">". check_output($story->subject) ." (". format_plural($story->count, "comment", "comments") .")
    Category:category) ."\">". check_output($story->category) ."
    Date:". format_date($story->timestamp) ."
    \n"; @@ -485,13 +477,13 @@ function account_track_stories() { function account_track_site() { global $theme, $user, $site_name; - $result1 = db_query("SELECT c.cid, c.pid, c.sid, c.subject, u.userid, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.sid WHERE s.status = 2 ORDER BY cid DESC LIMIT 10"); + $result1 = db_query("SELECT c.cid, c.pid, c.lid, c.subject, u.userid, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE s.status = 2 ORDER BY cid DESC LIMIT 10"); while ($comment = db_fetch_object($result1)) { $block1 .= "\n"; - $block1 .= " \n"; + $block1 .= " \n"; $block1 .= " \n"; - $block1 .= " \n"; + $block1 .= " \n"; $block1 .= "
    Comment:sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
    Comment:lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
    Author:". format_username($comment->userid) ."
    Story:sid\">". check_output($comment->story) ."
    Story:lid\">". check_output($comment->story) ."
    \n"; $block1 .= "

    \n"; } diff --git a/database/database.mysql b/database/database.mysql index 699407a45a3f..e293a2eb0041 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -57,7 +57,8 @@ CREATE TABLE channel ( CREATE TABLE comments ( cid int(6) DEFAULT '0' NOT NULL auto_increment, pid int(6) DEFAULT '0' NOT NULL, - sid int(6) DEFAULT '0' NOT NULL, + lid int(6) DEFAULT '0' NOT NULL, + link varchar(16) DEFAULT '' NOT NULL; author int(6) DEFAULT '0' NOT NULL, subject varchar(64) DEFAULT '' NOT NULL, comment text NOT NULL, @@ -137,7 +138,7 @@ CREATE TABLE users ( fake_email varchar(60) DEFAULT '' NOT NULL, url varchar(100) DEFAULT '' NOT NULL, stories tinyint(2) DEFAULT '10', - mode varchar(10) DEFAULT '', + mode tinyint(1) DEFAULT '0', sort tinyint(1) DEFAULT '0', threshold tinyint(1) DEFAULT '0', bio tinytext NOT NULL, diff --git a/includes/comment.inc b/includes/comment.inc index 110283b00d07..ed1e93c2f9c7 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -1,5 +1,15 @@ "List - min", 2 => "List - max", 3 => "Threaded - min", 4 => "Threaded - max"); +$corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high"); +$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) { $this->userid = $userid; @@ -14,4 +24,365 @@ class Comment { } } -?> +function comment_moderate($moderate) { + global $user, $comment_votes; + + if ($user->id && $moderate) { + $none = $comment_votes[key($comment_votes)]; + + foreach ($moderate as $id=>$vote) { + if ($vote != $comment_votes[$none] && !user_getHistory($user->history, "c$id")) { + // Update the comment's score: + $result = db_query("UPDATE comments SET score = score $vote, votes = votes + 1 WHERE cid = $id"); + + // Update the user's history: + user_setHistory($user, "c$id", $vote); + } + } + } +} + +function comment_settings($mode, $order, $threshold) { + global $user; + if ($user->id) { + $data[mode] = $mode; + $data[sort] = $order; + $data[threshold] = $threshold; + user_save($data, $user->id); + } +} + +function comment_reply($pid, $id) { + global $allowed_html, $link, $theme, $user; + + // 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"); + } + else { + $item = db_fetch_object(db_query("SELECT stories.*, users.userid FROM stories LEFT JOIN users ON stories.author = users.id WHERE stories.status != 0 AND stories.id = $id")); + $theme->article($item, ""); + } + + // Build reply form: + $output .= "

    \n"; + + // Name field: + $output .= "

    \n"; + $output .= " Your name:
    \n"; + $output .= format_username($user->userid); + $output .= "

    \n"; + + // Subject field: + $output .= "

    \n"; + $output .= " Subject:
    \n"; + $output .= " \n"; + $output .= "

    \n"; + + // Comment field: + $output .= "

    \n"; + $output .= " Comment:
    \n"; + $output .= "
    \n"; + $output .= " Allowed HTML tags: ". htmlspecialchars($allowed_html) .".\n"; + $output .= "

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

    \n"; + $output .= " You must preview at least once before you can submit:
    \n"; + $output .= " \n"; + $output .= " \n"; + $output .= "
    \n"; + $output .= "

    \n"; + + $output .= "
    \n"; + + $theme->box("Reply", $output); +} + +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"); + + // Build reply form: + $output .= "
    \n"; + + // Name field: + $output .= "

    \n"; + $output .= " Your name:
    \n"; + $output .= format_username($user->userid); + $output .= "

    \n"; + + // Subject field: + $output .= "

    \n"; + $output .= " Subject:
    \n"; + $output .= " \n"; + $output .= "

    \n"; + + // Comment field: + $output .= "

    \n"; + $output .= " Comment:
    \n"; + $output .= "
    \n"; + $output .= " Allowed HTML tags: ". htmlspecialchars($allowed_html) .".\n"; + $output .= "

    \n"; + + // Hidden fields: + $output .= "\n"; + $output .= "\n"; + + if (empty($subject)) { + $output .= "

    \n"; + $output .= " Warning: you did not supply a subject.\n"; + $outout .= "

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

    \n"; + $output .= " \n"; + $output .= " \n"; + $output .= "

    \n"; + $output .= "

    \n"; + + $theme->box("Reply", $output); +} + +function comment_post($pid, $id, $subject, $comment) { + global $theme, $link, $user; + + // Check for duplicate comments: + $duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE link = '$link' AND pid = '$pid' AND lid = '$id' AND subject = '". check_input($subject) ."' AND comment = '". check_input($comment) ."'"), 0); + + if ($duplicate != 0) { + watchdog("error", "discussion: attempt to insert duplicate comment"); + $theme->box("duplicate comment", "duplicate comment: $duplicate"); + } + else { + // Validate subject: + $subject = ($subject) ? $subject : substr($comment, 0, 29); + + // Add watchdog entry: + watchdog("comment", "discussion: added comment with subject '$subject'"); + + // 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")); + } +} + +function comment_score($comment) { + $value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0); + return ((strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00"); +} + +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; + + $threshold = ($user->id) ? $user->threshold : "0"; + $pid = ($pid) ? $pid : 0; + + $result = db_query("SELECT COUNT(cid) FROM comments WHERE lid = $lid AND pid = $pid AND ((votes = 0 AND score < $threshold) OR (score / votes < $threshold))"); + return ($result) ? db_result($result, 0) : 0; +} + +function comment_moderation($comment) { + global $comment_votes, $op, $user; + + if ($op == "reply") { + $output .= " "; + } + else if ($user->id && $user->userid != $comment->userid && !user_getHistory($user->history, "c$comment->cid")) { + $output .= "\n"; + } + else { + $output .= "
    score:". format_data($comment->score) ."
    votes:". format_data($comment->votes) ."
    \n"; + } + + return $output; +} + + +function comment_controls($threshold, $mode, $order) { + global $REQUEST_URI; + $output .= "\n"; + $output .= "
    \n"; + $output .= comment_threshold($threshold); + $output .= comment_mode($mode); + $output .= comment_order($order); + $output .= "\n"; + // $output .= "\n"; + $output .= "
    \n"; + $output .= "
    \n"; + return $output; +} + +function comment_threshold($threshold) { + $output .= "\n"; + return $output; +} + +function comment_mode($mode) { + global $cmodes; + $output .= "\n"; + return $output; +} + +function comment_order($order) { + global $corder; + $output .= "\n"; + return $output; +} + +function comment_query($link, $lid, $order, $pid = -1) { + $query .= "SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE link = '$link' AND c.lid = $lid"; + if ($pid >= 0) $query .= " AND pid = $pid"; + if ($order == 1) $query .= " ORDER BY c.timestamp DESC"; + if ($order == 2) $query .= " ORDER BY c.score DESC"; + return db_query($query); +} + +function comment_visible($comment, $threshold = 0) { + if ($comment->votes == 0 && $comment->score >= $threshold) return 1; + else if ($comment->votes > 0 && $comment->score / $comment->votes >= $threshold) return 1; + else return 0; +} + +function comment_uri($args = 0) { + global $link, $mod; + if ($args) return ($mod) ? "module.php?mod=$mod&$args" : $link .".php?$args"; + else return ($mod) ? "module.php?mod=$mod" : $link .".php"; +} + +function comment_link($comment, $return = 1) { + global $link, $theme; + if ($return) return "lid#$comment->cid") ."\">hlcolor2\">return | lid&pid=$comment->cid") ."\">hlcolor2\">reply to this comment"; + else return "lid&pid=$comment->cid") ."\">hlcolor2\">reply to this comment"; +} + +function comment_comment($comment, $folded = 0) { + global $link, $theme; + if ($folded) $theme->comment($comment, $folded); + else print "lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ." by ". format_username($comment->userid) ." (". $score = comment_score($comment) .")"; +} + +function comment_thread_min($cid, $threshold) { + global $user, $theme; + + $result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.pid = $cid ORDER BY c.timestamp, c.cid"); + + print ""; +} + +function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) { + global $link, $theme, $user; + + $result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE link = '$link' AND c.pid = $cid ORDER BY c.timestamp, c.cid"); + + print ""; +} + +function comment_render($lid, $cid) { + global $link, $theme, $REQUEST_URI, $user; + + // Pre-process variables: + $cid = empty($cid) ? 0 : $cid; + $mode = ($user->id) ? $user->mode : 4; + $order = ($user->id) ? $user->sort : 1; + $threshold = ($user->id) ? $user->threshold : 3; + + if ($user->id) { + // Print moderation form: + print "
    \n"; + } + + if ($cid > 0) { + $result = db_query("SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE cid = $cid"); + if ($comment = db_fetch_object($result)) { + $theme->comment($comment, comment_link($comment)); + } + } + else { + if ($mode == 1) { + $result = comment_query($link, $lid, $order); + print "\n"; + print " \n"; + while ($comment = db_fetch_object($result)) { + if (comment_visible($comment, $threshold)) { + print " \n"; + } + } + print "
    SubjectAuthorDateScore
    lid&cid=$comment->cid#$comment->cid") ."\">". check_output($comment->subject) ."". format_username($comment->userid) ."". format_date($comment->timestamp, "small") ."". comment_score($comment) ."
    \n"; + } + else if ($mode == 2) { + $result = comment_query($link, $lid, $order); + while ($comment = db_fetch_object($result)) { + if (comment_visible($comment, $threshold)) { + $theme->comment($comment, comment_link($comment, 0)); + } + } + } + else if ($mode == 3) { + $result = comment_query($link, $lid, $order, 0); + while ($comment = db_fetch_object($result)) { + comment_comment($comment); + comment_thread_min($comment->cid, $threshold); + } + } + else { + $result = comment_query($link, $lid, $order, 0); + while ($comment = db_fetch_object($result)) { + comment_comment($comment, (comment_visible($comment, $threshold) ? comment_link($comment, 0) : 0)); + comment_thread_max($comment->cid, $mode, $threshold, $level + 1); + } + } + } + + if ($user->id) { + // Print moderation form: + print " \n"; + print " \n"; + print "
    \n"; + } +} + +?> \ No newline at end of file diff --git a/includes/function.inc b/includes/function.inc index 71276e7801af..e564b3149018 100644 --- a/includes/function.inc +++ b/includes/function.inc @@ -12,11 +12,6 @@ function load_theme() { return new Theme(); } -function discussion_score($comment) { - $value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0); - return (strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00"; -} - function check_textfield($message) { global $allowed_html; return strip_tags(str_replace("\"", """, stripslashes($message)), $allowed_html); @@ -42,21 +37,6 @@ function check_output($message, $nl2br = 0) { else return strip_tags(stripslashes($message), $allowed_html); } -function discussion_num_replies($id, $count = 0) { - $result = db_query("SELECT COUNT(cid) FROM comments WHERE pid = $id"); - return ($result) ? db_result($result, 0) : 0; -} - -function discussion_num_filtered($sid, $pid) { - global $user; - - $threshold = ($user->id) ? $user->threshold : "0"; - $pid = ($pid) ? $pid : 0; - - $result = db_query("SELECT COUNT(cid) FROM comments WHERE sid = $sid AND pid = $pid AND (votes != 0 AND score / votes < $threshold)"); - return ($result) ? db_result($result, 0) : 0; -} - function format_plural($count, $singular, $plural) { return ($count == 1) ? "$count $singular" : "$count $plural"; } diff --git a/includes/submission.inc b/includes/submission.inc index 67c814079b9c..628aeae7591a 100644 --- a/includes/submission.inc +++ b/includes/submission.inc @@ -11,7 +11,7 @@ function submission_score($id) { } function submission_vote($id, $vote, $comment) { - global $user, $submission_post_threshold, $submission_dump_threshold; + global $submission_post_threshold, $submission_dump_threshold, $user; if (!user_getHistory($user->history, "s$id")) { // Update submission's score- and votes-field: @@ -21,7 +21,7 @@ function submission_vote($id, $vote, $comment) { if ($comment) { watchdog("comment", "moderation: added comment with subject '$subject'"); - db_query("INSERT INTO comments (sid, author, subject, comment, hostname, timestamp, score) VALUES($id, $user->id, '". check_input(substr($comment, 0, 29)) ." ...', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '" . ($user->userid ? 1 : 0) . "')"); + db_query("INSERT INTO comments (lid, link, author, subject, comment, hostname, timestamp, score) VALUES($id, 'story', $user->id, '". check_input(substr($comment, 0, 29)) ." ...', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '1')"); } // Update user's history record: diff --git a/includes/theme.inc b/includes/theme.inc index 33e11731cf54..da6f22797f04 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -79,7 +79,7 @@ function theme_blocks($region, $theme) { } function theme_morelink($theme, $story) { - return ($story->article) ? "[ id\">hlcolor2\">read more | ". strlen($story->article) ." bytes | id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]" : "[ id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]"; + return ($story->article) ? "[ id\">hlcolor2\">read more | ". strlen($story->article) ." bytes | id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]" : "[ id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]"; } function theme_moderation_results($theme, $story) { @@ -113,27 +113,12 @@ function theme_related_links($theme, $story) { $theme->box("Related links", $content); } -function theme_comment_moderation($comment) { - global $user, $comment_votes; - - if ($user->id && $user->userid != $comment->userid && !user_getHistory($user->history, "c$comment->cid")) { - $output .= "\n"; - } - else { - $output .= "
    score:". format_data($comment->score) ."
    votes:". format_data($comment->votes) ."
    "; - } - - return $output; -} - function theme_new_headlines($theme, $num = 10) { global $user; $content = ""; $result = db_query("SELECT id, subject FROM stories WHERE status = 2 ORDER BY id DESC LIMIT $num"); - while ($story = db_fetch_object($result)) $content .= "
  • id\">". check_output($story->subject) ."
  • \n"; + while ($story = db_fetch_object($result)) $content .= "
  • id\">". check_output($story->subject) ."
  • \n"; $content .= "

    [ hlcolor2\">more ]

    "; $theme->box("Latest headlines", $content); } @@ -149,12 +134,11 @@ function theme_old_headlines($theme, $num = 10) { $content .= "

    ". date("l, M jS", $story->timestamp) ."

    \n"; $time = date("F jS", $story->timestamp); } - $content .= "
  • id\">". check_output($story->subject) ."
  • \n"; + $content .= "
  • id\">". check_output($story->subject) ."
  • \n"; } $content .= "

    [ hlcolor2\">more ]

    "; $theme->box("Older headlines", $content); } - ?> diff --git a/index.php b/index.php index 8b5c29ec76c2..2dc1f4025ada 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ $number = ($user->stories) ? $user->stories : 10; $date = ($date) ? $date : time(); // Perform query: -$result = db_query("SELECT stories.*, users.userid, COUNT(comments.sid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.sid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number"); +$result = db_query("SELECT stories.*, users.userid, COUNT(comments.lid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.lid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number"); // Display stories: $theme->header(); diff --git a/modules/account.module b/modules/account.module index 4d382ccf49cc..942cf6072ada 100644 --- a/modules/account.module +++ b/modules/account.module @@ -87,15 +87,15 @@ function account_display($order = "username") { function account_stories($id) { $result = db_query("SELECT * FROM stories WHERE author = $id ORDER BY timestamp DESC"); while ($story = db_fetch_object($result)) { - $output .= "
  • id\">". check_output($story->subject) ."
  • \n"; + $output .= "
  • id\">". check_output($story->subject) ."
  • \n"; } return $output; } function account_comments($id) { - $result = db_query("SELECT * FROM comments WHERE author = $id ORDER BY timestamp DESC"); + $result = db_query("SELECT * FROM comments WHERE link = 'story' AND author = $id ORDER BY timestamp DESC"); while ($comment = db_fetch_object($result)) { - $output .= "
  • sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
  • \n"; + $output .= "
  • sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."
  • \n"; } return $output; } diff --git a/modules/comment.module b/modules/comment.module index db863616f2b7..bdda1cc0ea59 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -66,7 +66,7 @@ function comment_display($order = "date") { $output .= " \n"; while ($comment = db_fetch_object($result)) { - $output .= " sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."". format_username($comment->userid, 1) ."cid\">edit\n"; + $output .= " ". ($comment->link == "story" ? "lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."" : check_output($comment->subject)) ."". format_username($comment->userid, 1) ."cid\">edit\n"; } $output .= "\n"; diff --git a/modules/comment/comment.module b/modules/comment/comment.module index db863616f2b7..bdda1cc0ea59 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -66,7 +66,7 @@ function comment_display($order = "date") { $output .= " \n"; while ($comment = db_fetch_object($result)) { - $output .= " sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."". format_username($comment->userid, 1) ."cid\">edit\n"; + $output .= " ". ($comment->link == "story" ? "lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."" : check_output($comment->subject)) ."". format_username($comment->userid, 1) ."cid\">edit\n"; } $output .= "\n"; diff --git a/modules/drupal.module b/modules/drupal.module index d03a3bc5bfb1..fca8c61192a9 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -2,41 +2,80 @@ $module = array("page" => "drupal_page"); -include "includes/common.inc"; +include_once "includes/common.inc"; +include_once "includes/comment.inc"; -function drupal_page() { - global $theme; +function drupal_render($id, $cid) { + global $theme, $threshold, $mode, $order, $user; - $output .= " -

    Introduction

    -

    Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.

    -

    Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (http://slashcode.com/) and Scoop (http://scoop.kuro5hin.org/) and source code is available under terms of GNU General Public License (GPL).

    -

    Download

    -
  • drupal 1.00 (2000/01/15)
  • -
  • drupal 1.00-rc2 (2000/01/08)
  • -
  • drupal 1.00-rc1 (2000/01/01)
  • -

    Screenshots

    - "; + $output = "

    Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.

    \n"; + $output .= "

    Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (http://slashcode.com/) and Scoop (http://scoop.kuro5hin.org/). The source code is available under terms of GNU General Public License (GPL).

    \n"; + $output .= "

    We don't have a real demo site yet but drupal is used by (and created for) http://drop.org/. Create an account, play with it for a bit, read the documentation and spend some time getting used to it.

    \n"; + $theme->box("Introduction", $output); + + $output = "
  • drupal 1.00 (2000/01/15 - latest version)
  • \n"; + $output .= "
  • drupal 1.00-rc2 (2000/01/08)
  • \n"; + $output .= "
  • drupal 1.00-rc1 (2000/01/01)
  • \n"; + $theme->box("Download", $output); + unset($output); $handle = opendir("drupal"); while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= "
  • $file
  • \n"; closedir($handle); + $theme->box("Screenshots", $output); + + $output = "

    Documentation

    \n"; + $output .= "
  • documentation
  • \n"; + $output .= "
  • wishlist
  • \n"; + $output .= "

    Mailing list

    \n"; + $output .= "

    The drupal-support@drop.org list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.

    \n"; + $output .= "
  • To subscribe to the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org with no subject and put subscribe in the body of your message.
  • \n"; + $output .= "
  • To unsubscribe from the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org and put unsubscribe in the body of your mail.\n"; + $theme->box("Support and development", $output); - $output .= " -

    Demo

    -

    We don't have a real demo site yet but drupal is used by (and created for) http://drop.org/. Create an account, play with it for a bit, read the documentation and spend some time getting used to it.

    -

    Documentation

    -
  • documentation
  • -
  • wishlist
  • -

    Mailing list

    -

    The drupal-support@drop.org list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.

    -
  • To subscribe to the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org with no subject and put subscribe in the body of your message.
  • -
  • To unsubscribe from the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org and put unsubscribe in the body of your mail. - "; + print "

    Comments

    \n"; - $theme->header(); - $theme->box("Drupal", $output); - $theme->footer(); + // Display 'comment control'-box: + if ($user->id) $theme->controls($threshold, $mode, $order); + + // Display comments: + comment_render($id, $cid); } -?> +function drupal_page() { + global $cid, $comment, $id, $op, $pid, $lid, $link, $mode, $order, $subject, $theme, $threshold; + + switch($op) { + case "Preview comment": + $theme->header(); + comment_preview($pid, $id, $subject, $comment); + $theme->footer(); + break; + case "Post comment": + comment_post($pid, $id, $subject, $comment); + break; + case "reply": + $theme->header(); + comment_reply($pid, $id); + $theme->footer(); + break; + case "Update": + comment_settings($mode, $order, $threshold); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + case "Moderate comments": + comment_moderate($moderate); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + default: + $theme->header(); + drupal_render(0, $cid); + $theme->footer(); + } +} + +?> \ No newline at end of file diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index d03a3bc5bfb1..fca8c61192a9 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -2,41 +2,80 @@ $module = array("page" => "drupal_page"); -include "includes/common.inc"; +include_once "includes/common.inc"; +include_once "includes/comment.inc"; -function drupal_page() { - global $theme; +function drupal_render($id, $cid) { + global $theme, $threshold, $mode, $order, $user; - $output .= " -

    Introduction

    -

    Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.

    -

    Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (http://slashcode.com/) and Scoop (http://scoop.kuro5hin.org/) and source code is available under terms of GNU General Public License (GPL).

    -

    Download

    -
  • drupal 1.00 (2000/01/15)
  • -
  • drupal 1.00-rc2 (2000/01/08)
  • -
  • drupal 1.00-rc1 (2000/01/01)
  • -

    Screenshots

    - "; + $output = "

    Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.

    \n"; + $output .= "

    Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (http://slashcode.com/) and Scoop (http://scoop.kuro5hin.org/). The source code is available under terms of GNU General Public License (GPL).

    \n"; + $output .= "

    We don't have a real demo site yet but drupal is used by (and created for) http://drop.org/. Create an account, play with it for a bit, read the documentation and spend some time getting used to it.

    \n"; + $theme->box("Introduction", $output); + + $output = "
  • drupal 1.00 (2000/01/15 - latest version)
  • \n"; + $output .= "
  • drupal 1.00-rc2 (2000/01/08)
  • \n"; + $output .= "
  • drupal 1.00-rc1 (2000/01/01)
  • \n"; + $theme->box("Download", $output); + unset($output); $handle = opendir("drupal"); while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= "
  • $file
  • \n"; closedir($handle); + $theme->box("Screenshots", $output); + + $output = "

    Documentation

    \n"; + $output .= "
  • documentation
  • \n"; + $output .= "
  • wishlist
  • \n"; + $output .= "

    Mailing list

    \n"; + $output .= "

    The drupal-support@drop.org list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.

    \n"; + $output .= "
  • To subscribe to the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org with no subject and put subscribe in the body of your message.
  • \n"; + $output .= "
  • To unsubscribe from the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org and put unsubscribe in the body of your mail.\n"; + $theme->box("Support and development", $output); - $output .= " -

    Demo

    -

    We don't have a real demo site yet but drupal is used by (and created for) http://drop.org/. Create an account, play with it for a bit, read the documentation and spend some time getting used to it.

    -

    Documentation

    -
  • documentation
  • -
  • wishlist
  • -

    Mailing list

    -

    The drupal-support@drop.org list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.

    -
  • To subscribe to the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org with no subject and put subscribe in the body of your message.
  • -
  • To unsubscribe from the drupal-support@drop.org mailing list, send an e-mail to drupal-support-request@drop.org and put unsubscribe in the body of your mail. - "; + print "

    Comments

    \n"; - $theme->header(); - $theme->box("Drupal", $output); - $theme->footer(); + // Display 'comment control'-box: + if ($user->id) $theme->controls($threshold, $mode, $order); + + // Display comments: + comment_render($id, $cid); } -?> +function drupal_page() { + global $cid, $comment, $id, $op, $pid, $lid, $link, $mode, $order, $subject, $theme, $threshold; + + switch($op) { + case "Preview comment": + $theme->header(); + comment_preview($pid, $id, $subject, $comment); + $theme->footer(); + break; + case "Post comment": + comment_post($pid, $id, $subject, $comment); + break; + case "reply": + $theme->header(); + comment_reply($pid, $id); + $theme->footer(); + break; + case "Update": + comment_settings($mode, $order, $threshold); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + case "Moderate comments": + comment_moderate($moderate); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + default: + $theme->header(); + drupal_render(0, $cid); + $theme->footer(); + } +} + +?> \ No newline at end of file diff --git a/modules/headline.module b/modules/headline.module index 7629594d5202..3a42b3d764de 100644 --- a/modules/headline.module +++ b/modules/headline.module @@ -207,7 +207,7 @@ function headline_export($uri) { while ($story = db_fetch_object($result)) { print "\n"; print " $story->subject\n"; - print " ". $site_url ."discussion.php?id=$story->id\n"; + print " ". $site_url ."story.php?id=$story->id\n"; print "\n"; } diff --git a/modules/story.module b/modules/story.module index 4eb1534d49d2..2e0ea5b2315c 100644 --- a/modules/story.module +++ b/modules/story.module @@ -22,9 +22,9 @@ function story_help() { } function story_block() { - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'link' GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; + $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; } $blocks[0]["subject"] = "Top 10:
    all stories"; @@ -33,9 +33,9 @@ function story_block() { unset($content); - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; + $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; } $blocks[1]["subject"] = "Top 10:
    recent stories"; @@ -175,28 +175,28 @@ function story_display() { $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 1 ORDER BY timestamp DESC"); $output .= " queued stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."votes: $story->votes, score: $story->scoreid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."votes: $story->votes, score: $story->scoreid\">edit\n"; } // Scheduled stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 3 ORDER BY timestamp"); $output .= " scheduled stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." leftid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." leftid\">edit\n"; } // Dumped stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5"); $output .= " dumped stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; } // Posted stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15"); $output .= " posted stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; } $output .= "\n"; diff --git a/modules/story/story.module b/modules/story/story.module index 4eb1534d49d2..2e0ea5b2315c 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -22,9 +22,9 @@ function story_help() { } function story_block() { - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'link' GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; + $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; } $blocks[0]["subject"] = "Top 10:
    all stories"; @@ -33,9 +33,9 @@ function story_block() { unset($content); - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; + $content .= "
  • id\">$story->subject
    (". format_plural($story->comments, "comment", "comments") .")
  • \n"; } $blocks[1]["subject"] = "Top 10:
    recent stories"; @@ -175,28 +175,28 @@ function story_display() { $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 1 ORDER BY timestamp DESC"); $output .= " queued stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."votes: $story->votes, score: $story->scoreid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."votes: $story->votes, score: $story->scoreid\">edit\n"; } // Scheduled stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 3 ORDER BY timestamp"); $output .= " scheduled stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." leftid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." leftid\">edit\n"; } // Dumped stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5"); $output .= " dumped stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; } // Posted stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15"); $output .= " posted stories\n"; while ($story = db_fetch_object($result)) { - $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; + $output .= " id\">". check_output($story->subject) ."". format_username($story->userid, 1) ."$story->categoryid\">edit\n"; } $output .= "\n"; diff --git a/search.php b/search.php index 55bc757a148d..8ece2add4be1 100644 --- a/search.php +++ b/search.php @@ -39,7 +39,7 @@ $output .= " \n"; // Compose and perform query: - $query = "SELECT s.id, s.subject, u.userid, s.timestamp, COUNT(c.cid) AS comments FROM stories s LEFT JOIN users u ON s.author = u.id LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 "; + $query = "SELECT s.id, s.subject, u.userid, s.timestamp, COUNT(c.cid) AS comments FROM stories s LEFT JOIN users u ON s.author = u.id LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 "; $query .= ($author) ? "AND u.userid = '$author' " : ""; $query .= ($terms) ? "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.updates LIKE '%$terms%') " : ""; $query .= ($category) ? "AND s.category = '$category' GROUP BY s.id " : "GROUP BY s.id "; @@ -51,7 +51,7 @@ while ($entry = db_fetch_object($result)) { $num++; - $output .= "

    $num) id\">". check_output($entry->subject) ." (". format_plural($entry->comments, "comment", comments) .")
    by ". format_username($entry->userid) .", posted on ". format_date($entry->timestamp) .".

    \n"; + $output .= "

    $num) id\">". check_output($entry->subject) ." (". format_plural($entry->comments, "comment", comments) .")
    by ". format_username($entry->userid) .", posted on ". format_date($entry->timestamp) .".

    \n"; } if ($num == 0) $output .= "

    Your search did not match any articles in our database:

    \n"; diff --git a/submission.php b/submission.php index 7a8bfae04df0..e341d38e2a95 100644 --- a/submission.php +++ b/submission.php @@ -30,7 +30,7 @@ function submission_display_item($id) { $submission = db_fetch_object($result); if ($user->id == $submission->author || user_getHistory($user->history, "s$id")) { - header("Location: discussion.php?id=$id"); + header("Location: story.php?id=$id"); } else { $theme->header(); diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 3a7f189b2603..d63cbba76bb4 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -94,62 +94,15 @@ print "

    \n\n"; } - function commentControl($sid, $title, $threshold, $mode, $order) { - global $user; - - $query = db_query("SELECT sid FROM comments WHERE sid = $sid"); - - if (!$query) $count = 0; else $count = db_num_rows($query); - if (!isset($threshold)) $threshold = 0; - ?> - - - - -
    - - - - - - - - - - -
    bgcolor2"; ?>">bgcolor1" ?>">Comment control
    bgcolor1"; ?>"> -
    - - "> - - - - - -
    -
    bgcolor2"; ?>">At least below your threshold.
    -
    -

    - \n"; + print " \"\"\n"; + print " ". comment_controls($threshold, $mode, $order) ."\n"; + print " \"\"\n"; + print ""; } - function comment($comment, $link, $thread = "") { + function comment($comment, $link = "", $thread = "") { print "cid\">\n"; // Create comment header: @@ -168,7 +121,7 @@ // Moderation: print " \n"; - print theme_comment_moderation($comment); + print comment_moderation($comment); print " \n"; print " \n"; diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index a4e98c0ad9b1..bb93d4a604f7 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -140,64 +140,10 @@ - - "; - print " "; - print "
    - "; - print "
    bgcolor1\">fgcolor1\">Comment Control
    bgcolor2\">"; - - ?> -
    - - - - - "> - - - - 0) - { - ?> -
    There are at least below your threshold. -
    "; - ?> - -
    - "; + print comment_controls($threshold, $mode, $order); + print "
    "; } function comment($comment, $link, $thread = "") { @@ -224,7 +170,7 @@ // Moderation: echo " "; - print theme_comment_moderation($comment); + print comment_moderation($comment); echo " "; echo " ";