- Patch #204996 by chx: fixed access check and warning in poll module.
parent
46c716887b
commit
f04d4d17dd
|
@ -184,7 +184,8 @@ function poll_node_info() {
|
||||||
function poll_form(&$node, $form_state) {
|
function poll_form(&$node, $form_state) {
|
||||||
global $user;
|
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);
|
$type = node_get_types('type', $node);
|
||||||
|
|
||||||
$form = array(
|
$form = array(
|
||||||
|
@ -633,14 +634,17 @@ function poll_view_results(&$node, $teaser, $page, $block) {
|
||||||
$total_votes = 0;
|
$total_votes = 0;
|
||||||
$max_votes = 0;
|
$max_votes = 0;
|
||||||
foreach ($node->choice as $choice) {
|
foreach ($node->choice as $choice) {
|
||||||
|
if (isset($choice['chvotes'])) {
|
||||||
$total_votes += $choice['chvotes'];
|
$total_votes += $choice['chvotes'];
|
||||||
$max_votes = max($max_votes, $choice['chvotes']);
|
$max_votes = max($max_votes, $choice['chvotes']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$poll_results = '';
|
$poll_results = '';
|
||||||
foreach ($node->choice as $i => $choice) {
|
foreach ($node->choice as $i => $choice) {
|
||||||
if ($choice['chtext'] != '') {
|
if (!empty($choice['chtext'])) {
|
||||||
$poll_results .= theme('poll_bar', $choice['chtext'], $choice['chvotes'], $total_votes, isset($node->vote) && $node->vote == $i, $block);
|
$chvotes = isset($choice['chvotes']) ? $choice['chvotes'] : 0;
|
||||||
|
$poll_results .= theme('poll_bar', $choice['chtext'], $chvotes, $total_votes, isset($node->vote) && $node->vote == $i, $block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue