From 202eee42a929a0f48ce693e10943cc156ef5a7ef Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 31 Jul 2004 09:30:09 +0000 Subject: - Patch #9543 by JonBob: added node-level access control! --- modules/poll/poll.module | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'modules/poll/poll.module') diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 39f999543..214145848 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -27,10 +27,6 @@ function poll_help($section) { * Implementation of hook_access(). */ function poll_access($op, $node) { - if ($op == 'view') { - return $node->status; - } - if ($op == 'create') { return user_access('create polls'); } @@ -49,7 +45,7 @@ function poll_block($op = 'list', $delta = 0) { } else { // Retrieve the latest poll. - $timestamp = db_result(db_query("SELECT MAX(created) FROM {node} WHERE type = 'poll' AND status = '1' AND moderate = '0'")); + $timestamp = db_result(db_query('SELECT MAX(n.created) FROM {node} n '. node_access_join_sql() ." WHERE n.type = 'poll' AND n.status = 1 AND ". node_access_where_sql() .' AND n.moderate = 0')); if ($timestamp) { $poll = node_load(array('type' => 'poll', 'created' => $timestamp, 'moderate' => 0, 'status' => 1)); @@ -270,7 +266,7 @@ function poll_node_name($node) { function poll_page() { // List all polls - $result = pager_query("SELECT n.nid, n.title, p.active, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid=p.nid INNER JOIN {poll_choices} c ON n.nid=c.nid WHERE type = 'poll' AND status = '1' AND moderate = '0' GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC", 15); + $result = pager_query("SELECT DISTINCT(n.nid), n.title, p.active, SUM(c.chvotes) AS votes FROM {node} n ". node_access_join_sql() ." INNER JOIN {poll} p ON n.nid=p.nid INNER JOIN {poll_choices} c ON n.nid=c.nid WHERE type = 'poll' AND status = 1 AND ". node_access_where_sql() ." AND moderate = 0 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC", 15); $output = '