summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2001-06-07 15:42:28 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2001-06-07 15:42:28 +0000
commit28e6fdfbf386d0d3ffd50cc6aa528be8f7875b38 (patch)
tree8b036b367d9a6d18fdb34bd4f5664fed64d9d627
parentc94d9a063b7f630cc4cee7c582fe3e965fb1eb5c (diff)
downloadbrdo-28e6fdfbf386d0d3ffd50cc6aa528be8f7875b38.tar.gz
brdo-28e6fdfbf386d0d3ffd50cc6aa528be8f7875b38.tar.bz2
- Fixed block showing queued polls. Now only shows active, posted polls.
- Fixed votes being reset to zero when updating a poll - Fixed that weird crashing bug on the poll form (Natrak)
-rw-r--r--modules/poll.module7
-rw-r--r--modules/poll/poll.module7
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/poll.module b/modules/poll.module
index 3b6e01cd4..8f2c53465 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -178,7 +178,7 @@ function poll_form($edit = array(), $nocheck = 0) {
if ($admin && !is_array($edit[choices])) $edit = poll_get_choices_array($edit);
/* Mini-form for number of choiceboxes */
- $choices = $edit[choices]?$edit[choices]:max(5,sizeof($edit[choice]));
+ $choices = $edit[choices] ? $edit[choices] : max(5, count($edit[choice]));
for ($c = 2; $c <= 20; $c++) $opts[$c]=$c;
$form .= form_select(t("Number of choices"), "choices", $choices, $opts, t("This box only specifies the number of boxes in this form, it doesn't have to equal the actual amount of choices in the poll."));
$form .= form_submit(t("Preview")) . "<br><br><br>";
@@ -235,7 +235,7 @@ function poll_save($edit) {
if ($nid) {
foreach ($edit[choice] as $key => $value) {
if ($value) {
- $v[] = "('" . $nid . "', '" . check_input($value) . "', '". check_input($edit[votes][$key]) ."', '". check_input($key) ."')";
+ $v[] = "('" . $nid . "', '" . check_input($value) . "', '". check_input($edit[chvotes][$key]) ."', '". check_input($key) ."')";
}
}
db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES " . implode(",", $v));
@@ -243,9 +243,10 @@ function poll_save($edit) {
}
function poll_block() {
+ global $status;
$result = _node_get(array("type" => "poll"));
while ($poll = db_fetch_object($result)) {
- if ($poll->active) {
+ if (($poll->active) && ($poll->status == $status[posted])) {
$content = poll_view($poll, 0, 1);
$output = "<b>" . $content[title] . "</b><br>" . $content[content] . "<br><div align=\"center\">[ <a href=\"node.php?id=" . $poll->nid . "\">" . t("Read more") . "</a> ]</div>";
break;
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 3b6e01cd4..8f2c53465 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -178,7 +178,7 @@ function poll_form($edit = array(), $nocheck = 0) {
if ($admin && !is_array($edit[choices])) $edit = poll_get_choices_array($edit);
/* Mini-form for number of choiceboxes */
- $choices = $edit[choices]?$edit[choices]:max(5,sizeof($edit[choice]));
+ $choices = $edit[choices] ? $edit[choices] : max(5, count($edit[choice]));
for ($c = 2; $c <= 20; $c++) $opts[$c]=$c;
$form .= form_select(t("Number of choices"), "choices", $choices, $opts, t("This box only specifies the number of boxes in this form, it doesn't have to equal the actual amount of choices in the poll."));
$form .= form_submit(t("Preview")) . "<br><br><br>";
@@ -235,7 +235,7 @@ function poll_save($edit) {
if ($nid) {
foreach ($edit[choice] as $key => $value) {
if ($value) {
- $v[] = "('" . $nid . "', '" . check_input($value) . "', '". check_input($edit[votes][$key]) ."', '". check_input($key) ."')";
+ $v[] = "('" . $nid . "', '" . check_input($value) . "', '". check_input($edit[chvotes][$key]) ."', '". check_input($key) ."')";
}
}
db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES " . implode(",", $v));
@@ -243,9 +243,10 @@ function poll_save($edit) {
}
function poll_block() {
+ global $status;
$result = _node_get(array("type" => "poll"));
while ($poll = db_fetch_object($result)) {
- if ($poll->active) {
+ if (($poll->active) && ($poll->status == $status[posted])) {
$content = poll_view($poll, 0, 1);
$output = "<b>" . $content[title] . "</b><br>" . $content[content] . "<br><div align=\"center\">[ <a href=\"node.php?id=" . $poll->nid . "\">" . t("Read more") . "</a> ]</div>";
break;