From 3b8c99d91e3733427e9f821ed385f097d18e8ffa Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 11 Jun 2003 18:16:32 +0000 Subject: - Bugfix: fixed the CREATE FUNCTION in database.mssql as it needs to be prefixed with GO for some obscure reason. Patch by Kjartan. - Bugfix: fixed the defaults for blocks in database.mssql so the NOT NULL fields get values. Patch by Kjartan. - Bugfix: changed check_form() to use htmlspecialchars() instead of drupal_specialchars() as this caused Drupal to emit incorrect form items in presence of quotes. Example: IMO, drupal_specialchars() is better called xmlspecialchars() to avoid confusion. - Bugfix: when an anonymous user visits a site, they shouldn't see any content (except the login block, if it is enabled) unless they have the "access content" permissions. Patch by Matt Westgate. - Improvement: improved the error checking and the error messages in the profile module. Updated the code to match the Drupal coding conventions. Modified patch from Matt Westgate. - Improvement: don't generate the tag in the base theme; it is already emitted by theme_head(). Patch by Kristjan. - Improvement: don't execute any SQL queries when checking the permissions of user #1. Patch by Kjartan. - Improvement: made a scalable layout form that works in IE and that behaves better with narrow themes. Part of patch #51 by Al. - Improvement: removed some redundant print statements from the comment module. Modified patch from Craig Courtney. --- modules/poll.module | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'modules/poll.module') diff --git a/modules/poll.module b/modules/poll.module index 2dcb835ee..f799bf5e1 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -43,22 +43,24 @@ function poll_access($op, $node) { } function poll_block($op = "list", $delta = 0) { - if ($op == "list") { - $blocks[0]["info"] = t("Most recent poll"); - return $blocks; - } - else { - $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type = 'poll' AND status = '1' AND moderate = '0'")); - if ($timestamp) { - $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); - if ($poll->nid) { - // Poll_view dumps the output into $poll->body - poll_view($poll, 1, 1); + if (user_access("access content")) { + if ($op == "list") { + $blocks[0]["info"] = t("Most recent poll"); + return $blocks; + } + else { + $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type = 'poll' AND status = '1' AND moderate = '0'")); + if ($timestamp) { + $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); + if ($poll->nid) { + // Poll_view dumps the output into $poll->body + poll_view($poll, 1, 1); + } } + $block["subject"] = t("Poll: %t", array("%t" => $poll->title)); + $block["content"] = $poll->body; + return $block; } - $block["subject"] = t("Poll: %t", array("%t" => $poll->title)); - $block["content"] = $poll->body; - return $block; } } -- cgit v1.2.3