Commit ee12d111 authored by Steven Wittens's avatar Steven Wittens
Browse files

poll.module - made the poll-durations a lot more locale friendly (using format_interval();)

parent 48029fe2
......@@ -172,7 +172,7 @@ function poll_view($node, $main = 0, $block = 0) {
function poll_form($edit = array(), $nocheck = 0) {
global $REQUEST_URI, $user;
$duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"), 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"), 10713600 => t("4 months"), 31536000 => t("1 year"));
$duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
$active = array(0 => "Closed", 1 => "Active");
$admin = ($edit[nid] && user_access("administer nodes")) ? 1 : 0;
......@@ -180,7 +180,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(2, count($edit[choice]));
$choices = $edit[choices] ? $edit[choices] : max(2, count($edit[choices]) ? count($edit[choices]) : 5);
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>";
......@@ -249,7 +249,7 @@ function poll_block() {
while ($poll = db_fetch_object($result)) {
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>";
$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;
}
}
......
......@@ -172,7 +172,7 @@ function poll_view($node, $main = 0, $block = 0) {
function poll_form($edit = array(), $nocheck = 0) {
global $REQUEST_URI, $user;
$duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"), 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"), 10713600 => t("4 months"), 31536000 => t("1 year"));
$duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
$active = array(0 => "Closed", 1 => "Active");
$admin = ($edit[nid] && user_access("administer nodes")) ? 1 : 0;
......@@ -180,7 +180,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(2, count($edit[choice]));
$choices = $edit[choices] ? $edit[choices] : max(2, count($edit[choices]) ? count($edit[choices]) : 5);
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>";
......@@ -249,7 +249,7 @@ function poll_block() {
while ($poll = db_fetch_object($result)) {
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>";
$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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment