From de5b9a168daeef12b6f7bcf6e43b767a2d7f35d8 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Mon, 22 Apr 2002 09:05:36 +0000 Subject: - bug fixes: * fixed mails not being parsed properly. * tracker now shows user name when you view your own recent comments. * link to submission queue now points to the right place. * fixed jabber module. * theme is now activated when changed. - applied Gerhards coding style patch. --- modules/poll/poll.module | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'modules/poll/poll.module') diff --git a/modules/poll/poll.module b/modules/poll/poll.module index d0ab4dbf0..9d9b16f76 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -28,7 +28,7 @@ function poll_block() { function poll_cron() { // Close polls that have exceeded their allowed runtime - $result = db_query("SELECT p.nid FROM poll p LEFT JOIN node n ON p.nid=n.nid WHERE (n.created + p.runtime) < '" . time() . "' AND p.active = '1' AND p.runtime != '0'"); + $result = db_query("SELECT p.nid FROM poll p LEFT JOIN node n ON p.nid=n.nid WHERE (n.created + p.runtime) < '". time() ."' AND p.active = '1' AND p.runtime != '0'"); while ($poll = db_fetch_object($result)) { db_query("UPDATE poll SET active='0' WHERE nid='$poll->nid'"); } @@ -55,12 +55,12 @@ function poll_form(&$node, &$help, &$error) { } if ($node->chvotes[$i] < 0) { - $error["chvotes][$i"] = "" . t("Negative values are not allowed.") . ""; + $error["chvotes][$i"] = "". t("Negative values are not allowed.") .""; } } if ($actualchoices < 2) { - $error["choice][0"] = "" . t("You must fill in at least two choices.") . ""; + $error["choice][0"] = "". t("You must fill in at least two choices.") .""; } } else { @@ -71,10 +71,10 @@ function poll_form(&$node, &$help, &$error) { $opts[$c] = $c; } $output .= form_select(t("Number of choices"), "choices", $node->choices, $opts, t("This item only specifies the number of boxes in this form, but it doesn't have to equal the actual amount of options: you can leave the extra boxes empty.")); - $output .= form_submit(t("Preview")) . "


"; + $output .= form_submit(t("Preview")) ."


"; for ($a = 0; $a < $node->choices; $a++) { - $output .= form_textfield(t("Choice"). " " . ($a + 1), "choice][$a", $node->choice[$a], 50, 127, $error["choice][$a"]); + $output .= form_textfield(t("Choice") ." ". ($a + 1), "choice][$a", $node->choice[$a], 50, 127, $error["choice][$a"]); if ($admin) { $output .= form_textfield(t("Votes for choice %n", array("%n" => ($a + 1))), "chvotes][$a", $node->chvotes[$a] ? $node->chvotes[$a] : 0, 7, 7, $error["chvotes][$a"]); } @@ -97,8 +97,7 @@ function poll_help() { function poll_insert($node) { if (!user_access("administer nodes")) { // Make sure all votes are 0 initially - for ($i = 0; $i < count($node->chvotes); $i++) - $node->chvotes[$i] = 0; + for ($i = 0; $i < count($node->chvotes); $i++) $node->chvotes[$i] = 0; $node->active = 1; } @@ -192,7 +191,7 @@ function poll_view(&$node, $main = 0, $block = 0) { if (user_access("vote on polls")) { if ($user->uid) { // Pad the UID with underscores to allow a simple strstr() search - $id = "_" . $user->uid . "_"; + $id = "_". $user->uid ."_"; } else { $id = $REMOTE_ADDR; @@ -205,7 +204,7 @@ function poll_view(&$node, $main = 0, $block = 0) { if (($pollid == $pollidcount) && isset($pollvote) && ($allowvotes)) { // The user has submitted a valid vote if (!empty($node->choice[$pollvote])) { - $node->voters = $node->voters ? ($node->voters . " " . $id) : $id; + $node->voters = $node->voters ? ($node->voters ." ". $id) : $id; db_query("UPDATE poll SET voters='$node->voters' WHERE nid='$node->nid'"); db_query("UPDATE poll_choices SET chvotes = chvotes + 1 WHERE nid='$node->nid' AND chorder='$pollvote'"); $allowvotes = false; @@ -215,7 +214,7 @@ function poll_view(&$node, $main = 0, $block = 0) { if ($allowvotes) { // Display the vote form - $url = request_uri() . (strstr(request_uri(), "?") ? "&" : "?") . "pollid=" . $pollidcount; + $url = request_uri() . (strstr(request_uri(), "?") ? "&" : "?") ."pollid=". $pollidcount; $output .= "
"; $output .= "
"; @@ -225,9 +224,9 @@ function poll_view(&$node, $main = 0, $block = 0) { } } if ($block) { - $output .= "
" . form_submit(t("Vote")) . "
"; + $output .= "
". form_submit(t("Vote")) ."
"; } else { - $output .= "
   " . form_submit(t("Vote")) . "
"; + $output .= "
   ". form_submit(t("Vote")) ."
"; } $output .= "
"; } @@ -243,8 +242,8 @@ function poll_view(&$node, $main = 0, $block = 0) { // Define CSS classes for the bars $output .= ""; foreach ($node->choice as $key => $value) { @@ -252,7 +251,7 @@ function poll_view(&$node, $main = 0, $block = 0) { $width = round($node->chvotes[$key] * 100 / $votesmax); $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1)); - $output .= "
$value
$percentage%" . (!$block ? " (" . $node->chvotes[$key] . " votes)" : "") . "
"; + $output .= "
$value
$percentage%". (!$block ? " (". $node->chvotes[$key] ." votes)" : "") ."
"; if ($width == 0) { $output .= "
 
"; } @@ -260,11 +259,11 @@ function poll_view(&$node, $main = 0, $block = 0) { $output .= "
 
"; } else { - $output .= "
  
"; + $output .= "
  
"; } } } - $output .= "
Total votes: " . $votestotal . "
"; + $output .= "
Total votes: ". $votestotal ."
"; } // Force the output on both the mainpage and elsewhere $node->body = $output; -- cgit v1.2.3