From 4371b627d51ffc5af9498fa1877d8e519a5f2c6e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Feb 2001 15:14:56 +0000 Subject: - added fine-grained user permission system which allows us to give certain users access to specific administration sections only. Ex. a FAQ maintainer can only edit the FAQ, and members of an "editorial board" can only edit comments, diaries and stories, .. - code review => rewrote include/user.inc which is much easier now - fixed 4 small bugs --- includes/comment.inc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'includes/comment.inc') diff --git a/includes/comment.inc b/includes/comment.inc index c64a3e4dd..44909ac65 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -32,12 +32,12 @@ function comment_moderate($moderate) { $none = $comment_votes[key($comment_votes)]; foreach ($moderate as $id=>$vote) { - if ($vote != $comment_votes[$none] && !user_get_history($user->history, "c$id")) { + if ($vote != $comment_votes[$none] && !user_get($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_set_history("c$id", $vote); + $user = user_set($user, "history", "c$id", $vote); } } } @@ -45,12 +45,7 @@ function comment_moderate($moderate) { 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); - } + if ($user->id) $user = user_save($user, array("mode" => $mode, "sort" => $order, "threshold" => $threshold)); } function comment_reply($pid, $id) { @@ -180,7 +175,7 @@ function comment_moderation($comment) { if ($op == "reply") { $output .= " "; } - else if ($user->id && $user->userid != $comment->userid && !user_get_history($user->history, "c$comment->cid")) { + else if ($user->id && $user->userid != $comment->userid && !user_get($user, "history", "c$comment->cid")) { $output .= "\n"; -- cgit v1.2.3