aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorJim Wigginton <terrafrost@phpbb.com>2009-02-26 23:46:46 +0000
committerJim Wigginton <terrafrost@phpbb.com>2009-02-26 23:46:46 +0000
commit2e50df9e1a140f322e091d74500e05b6545a54e1 (patch)
tree15ab2bfacfaebfeedb862deed1ce56d6df2b53cf /phpBB/includes/functions_posting.php
parent354f9edd4e747b6927a8b2c1e454be1c366cf232 (diff)
downloadforums-2e50df9e1a140f322e091d74500e05b6545a54e1.tar
forums-2e50df9e1a140f322e091d74500e05b6545a54e1.tar.gz
forums-2e50df9e1a140f322e091d74500e05b6545a54e1.tar.bz2
forums-2e50df9e1a140f322e091d74500e05b6545a54e1.tar.xz
forums-2e50df9e1a140f322e091d74500e05b6545a54e1.zip
Fixed bug #'ers 41295, 41385, 41955, 41705 and 41985
Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9342 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index f7fe3e5f38..1b0fbb835a 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1751,11 +1751,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if (isset($poll['poll_options']) && !empty($poll['poll_options']))
{
+ $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
+ $poll_length = $poll['poll_length'] * 86400;
+ if ($poll_length < 0)
+ {
+ $poll_start = $poll_start + $poll_length;
+ if ($poll_start < 0)
+ {
+ $poll_start = 0;
+ }
+ $poll_length = 1;
+ }
+
$sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array(
'poll_title' => $poll['poll_title'],
- 'poll_start' => ($poll['poll_start']) ? $poll['poll_start'] : $current_time,
+ 'poll_start' => $poll_start,
'poll_max_options' => $poll['poll_max_options'],
- 'poll_length' => ($poll['poll_length'] * 86400),
+ 'poll_length' => $poll_length,
'poll_vote_change' => $poll['poll_vote_change'])
);
}
@@ -1784,6 +1796,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_topic':
case 'edit_first_post':
+ if (isset($poll['poll_options']) && !empty($poll['poll_options']))
+ {
+ $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
+ $poll_length = $poll['poll_length'] * 86400;
+ if ($poll_length < 0)
+ {
+ $poll_start = $poll_start + $poll_length;
+ if ($poll_start < 0)
+ {
+ $poll_start = 0;
+ }
+ $poll_length = 1;
+ }
+ }
$sql_data[TOPICS_TABLE]['sql'] = array(
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
@@ -1794,9 +1820,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_type' => $topic_type,
'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0,
'poll_title' => (isset($poll['poll_options'])) ? $poll['poll_title'] : '',
- 'poll_start' => (isset($poll['poll_options'])) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0,
+ 'poll_start' => (isset($poll['poll_options'])) ? $poll_start : 0,
'poll_max_options' => (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1,
- 'poll_length' => (isset($poll['poll_options'])) ? ($poll['poll_length'] * 86400) : 0,
+ 'poll_length' => (isset($poll['poll_options'])) ? $poll_length : 0,
'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0,
'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),