diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2001-05-23 12:19:35 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2001-05-23 12:19:35 +0000 |
commit | 71c1162465322f055204e3d40d75f696c26b3784 (patch) | |
tree | 6372aafe3f215858ad8e7feb6fb65a2287498019 | |
parent | 404cd22b3a52aa90bf982ae9e12c461f517ea8f9 (diff) | |
download | brdo-71c1162465322f055204e3d40d75f696c26b3784.tar.gz brdo-71c1162465322f055204e3d40d75f696c26b3784.tar.bz2 |
Fixed the poll block being messed up a lot. Stupid objects and arrays mixup :P
Please update drop.org as soon as possible, coz my crappy poll.mod is making drupal look bad :(
-rw-r--r-- | modules/poll.module | 10 | ||||
-rw-r--r-- | modules/poll/poll.module | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/modules/poll.module b/modules/poll.module index e299cc2c7..533a9b5e7 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -25,7 +25,7 @@ function poll_cron() { } function poll_get_choices_array($poll) { - if (!$poll[choice]) { + if (!is_array($poll[choice])) { $result = db_query("SELECT * FROM poll_choices WHERE nid='" . $poll[nid] . "'"); if ($result) { while ($choices = db_fetch_array($result)) { @@ -44,7 +44,7 @@ function poll_get_choices_array($poll) { } function poll_get_choices_obj($poll) { - if (!$poll->choice) { + if (!is_array($poll->choice)) { $result = db_query("SELECT * FROM poll_choices WHERE nid='" . $poll->nid . "'"); if ($result) { while ($choices = db_fetch_array($result)) { @@ -99,7 +99,7 @@ function poll_view($node, $main = 0, $block = 0) { $result = db_query("UPDATE poll_choices SET chvotes=chvotes+1 WHERE nid='" . $node->nid . "' && chid='" . check_input($chid) . "'"); if (($result) && ($user)) { $new = node_get_array(array("nid" => $node->nid)); - $new[voters] = field_set($node->voters, $user->userid,1); + $new[voters] = field_set($node->voters, $user->userid, 1); node_save($new, array(voters)); $node = node_get_object(array("nid" => $node->nid)); } @@ -229,8 +229,8 @@ function poll_save($edit) { function poll_block() { $result = _node_get(array("type" => "poll")); - while ($poll = db_fetch_array($result)) { - if ($poll[active]) { + while ($poll = db_fetch_object($result)) { + if ($poll->active) { $poll = poll_view($poll, 0, 1); $output = "<b>" . $poll[title] . "</b><br>" . $poll[content]; break; diff --git a/modules/poll/poll.module b/modules/poll/poll.module index e299cc2c7..533a9b5e7 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -25,7 +25,7 @@ function poll_cron() { } function poll_get_choices_array($poll) { - if (!$poll[choice]) { + if (!is_array($poll[choice])) { $result = db_query("SELECT * FROM poll_choices WHERE nid='" . $poll[nid] . "'"); if ($result) { while ($choices = db_fetch_array($result)) { @@ -44,7 +44,7 @@ function poll_get_choices_array($poll) { } function poll_get_choices_obj($poll) { - if (!$poll->choice) { + if (!is_array($poll->choice)) { $result = db_query("SELECT * FROM poll_choices WHERE nid='" . $poll->nid . "'"); if ($result) { while ($choices = db_fetch_array($result)) { @@ -99,7 +99,7 @@ function poll_view($node, $main = 0, $block = 0) { $result = db_query("UPDATE poll_choices SET chvotes=chvotes+1 WHERE nid='" . $node->nid . "' && chid='" . check_input($chid) . "'"); if (($result) && ($user)) { $new = node_get_array(array("nid" => $node->nid)); - $new[voters] = field_set($node->voters, $user->userid,1); + $new[voters] = field_set($node->voters, $user->userid, 1); node_save($new, array(voters)); $node = node_get_object(array("nid" => $node->nid)); } @@ -229,8 +229,8 @@ function poll_save($edit) { function poll_block() { $result = _node_get(array("type" => "poll")); - while ($poll = db_fetch_array($result)) { - if ($poll[active]) { + while ($poll = db_fetch_object($result)) { + if ($poll->active) { $poll = poll_view($poll, 0, 1); $output = "<b>" . $poll[title] . "</b><br>" . $poll[content]; break; |