From f04d4d17dd6a7c94bf10b564930a4448d5449c3d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 31 Dec 2007 08:48:41 +0000 Subject: - Patch #204996 by chx: fixed access check and warning in poll module. --- modules/poll/poll.module | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/poll/poll.module b/modules/poll/poll.module index b8fde337e..7500eff8a 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -184,7 +184,8 @@ function poll_node_info() { function poll_form(&$node, $form_state) { global $user; - $admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->uid == $node->nid); + $admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->uid == $node->uid); + $type = node_get_types('type', $node); $form = array( @@ -633,14 +634,17 @@ function poll_view_results(&$node, $teaser, $page, $block) { $total_votes = 0; $max_votes = 0; foreach ($node->choice as $choice) { - $total_votes += $choice['chvotes']; - $max_votes = max($max_votes, $choice['chvotes']); + if (isset($choice['chvotes'])) { + $total_votes += $choice['chvotes']; + $max_votes = max($max_votes, $choice['chvotes']); + } } $poll_results = ''; foreach ($node->choice as $i => $choice) { - if ($choice['chtext'] != '') { - $poll_results .= theme('poll_bar', $choice['chtext'], $choice['chvotes'], $total_votes, isset($node->vote) && $node->vote == $i, $block); + if (!empty($choice['chtext'])) { + $chvotes = isset($choice['chvotes']) ? $choice['chvotes'] : 0; + $poll_results .= theme('poll_bar', $choice['chtext'], $chvotes, $total_votes, isset($node->vote) && $node->vote == $i, $block); } } -- cgit v1.2.3