summaryrefslogtreecommitdiff
path: root/modules/poll/poll.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-12-31 08:48:41 +0000
committerDries Buytaert <dries@buytaert.net>2007-12-31 08:48:41 +0000
commitf04d4d17dd6a7c94bf10b564930a4448d5449c3d (patch)
tree98cae3855940c46260d7a4c421fb212d218812c6 /modules/poll/poll.module
parent46c716887ba012267653217cd802ed8c247936c1 (diff)
downloadbrdo-f04d4d17dd6a7c94bf10b564930a4448d5449c3d.tar.gz
brdo-f04d4d17dd6a7c94bf10b564930a4448d5449c3d.tar.bz2
- Patch #204996 by chx: fixed access check and warning in poll module.
Diffstat (limited to 'modules/poll/poll.module')
-rw-r--r--modules/poll/poll.module14
1 files changed, 9 insertions, 5 deletions
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);
}
}