From 4e132c9fd5ee53b5ad7317de6899f1ea2207ab09 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 6 Jul 2000 09:37:30 +0000 Subject: * _Major_ update of the comments and moderation system: it's a lot more stream-lined and more compact. There are a few parts I like to optimize prior to heading towards comment moderation. Please test, report bugs and update the footer()-part of your themes a bit (see my theme)!!! -- Dries --- functions.inc | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'functions.inc') diff --git a/functions.inc b/functions.inc index e118e98c5..fde0bc37c 100644 --- a/functions.inc +++ b/functions.inc @@ -30,13 +30,13 @@ function morelink_bytes($theme, $story) { ### Compose more-link: $morelink = "[ "; if ($story->article) { - $morelink .= "id"; + $morelink .= "id"; $morelink .= ($user->umode) ? "&mode=$user->umode" : "&mode=threaded"; $morelink .= ($user->uorder) ? "&order=$user->uorder" : "&order=0"; $morelink .= ($user->thold) ? "&thold=$user->thold" : "&thold=0"; $morelink .= "\">hlcolor2\">read more | $bytes bytes in body | "; } - $morelink .= "id"; + $morelink .= "id"; $morelink .= ($user->umode) ? "&mode=$user->umode" : "&mode=threaded"; $morelink .= ($user->uorder) ? "&order=$user->uorder" : "&order=0"; $morelink .= ($user->thold) ? "&thold=$user->thold" : "&thold=0"; @@ -96,9 +96,32 @@ function addRefer($url) { } } +function id2story($id) { + ### Perform query: + $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id"); + return db_fetch_object($result); +} + +function displayModerationResults($theme, $story) { + global $user; + + if ($user->id && $story->id && $vote = $user->getHistory("s$story->id")) { + $output .= "

You voted `$vote'.

\n"; + $output .= "

\n"; + $output .= "Other people voted:
\n"; + + $result = db_query("SELECT * FROM users WHERE history LIKE '%s$story->id%'"); + while ($account = db_fetch_object($result)) { + $output .= "
userid\">$account->userid voted `". getHistory($account->history, "s$story->id") ."'.
"; + } + + $theme->box("Moderation results", $output); + } +} + function displayRelatedLinks($theme, $story) { ### Parse story for -tags: - $text = "$story->abstract $story->editorial $story->article"; + $text = "$story->abstract $story->updates $story->article"; while ($text = stristr($text, "") + 4); $text = stristr($text, ""); @@ -125,14 +148,14 @@ function displayOldHeadlines($theme, $num = 10) { } if ($user->userid) { - $content .= "

  • id"; + $content .= "
  • id"; $content .= ($user->umode) ? "&mode=$user->umode" : "&mode=threaded"; $content .= ($user->uorder) ? "&order=$user->uorder" : "&order=0"; $content .= ($user->thold) ? "&thold=$user->thold" : "&thold=0"; $content .= "\">$story->subject
  • "; } else { - $content .= "
  • id&mode=threaded&order=1&thold=0\">$story->subject
  • "; + $content .= "
  • id&mode=threaded&order=1&thold=0\">$story->subject
  • "; } } $content .= "

    [ hlcolor2\">more ]

    "; @@ -147,14 +170,14 @@ function displayNewHeadlines($theme, $num = 10) { $result = db_query("SELECT id, subject FROM stories WHERE status = 2 ORDER BY id DESC LIMIT $num"); while ($story = db_fetch_object($result)) { if ($user->userid) { - $content .= "
  • id"; + $content .= "
  • id"; $content .= ($user->umode) ? "&mode=$user->umode" : "&mode=threaded"; $content .= ($user->uorder) ? "&order=$user->uorder" : "&order=0"; $content .= ($user->thold) ? "&thold=$user->thold" : "&thold=0"; $content .= "\">$story->subject
  • "; } else { - $content .= "
  • id&mode=threaded&order=1&thold=0\">$story->subject
  • "; + $content .= "
  • id&mode=threaded&order=1&thold=0\">$story->subject
  • "; } } $content .= "

    [ hlcolor2\">more ]

    "; -- cgit v1.2.3