aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2007-10-29 13:39:34 +0000
committerHenry Sudhof <kellanved@phpbb.com>2007-10-29 13:39:34 +0000
commit04ebbeca3fa00b3f11493c68d393405aeb90ed09 (patch)
tree6932cdbc1a7e0ad1ef7f1e4e5fb2b7e907b262e8
parent2adef2c45775bc1eb957cbfd3825eff743568b92 (diff)
downloadforums-04ebbeca3fa00b3f11493c68d393405aeb90ed09.tar
forums-04ebbeca3fa00b3f11493c68d393405aeb90ed09.tar.gz
forums-04ebbeca3fa00b3f11493c68d393405aeb90ed09.tar.bz2
forums-04ebbeca3fa00b3f11493c68d393405aeb90ed09.tar.xz
forums-04ebbeca3fa00b3f11493c68d393405aeb90ed09.zip
'1' might not have been a good choice
git-svn-id: file:///svn/phpbb/trunk@8216 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php2
-rw-r--r--phpBB/language/en/viewtopic.php1
-rw-r--r--phpBB/viewtopic.php18
4 files changed, 18 insertions, 5 deletions
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 18e92d70c0..c3bb2aa468 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -169,7 +169,7 @@ define('FIELD_DATE', 6);
// Additional constants
-
+define('VOTE_CONVERTED', 9999);
// Table names
define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups');
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 91a9951e90..cb26833212 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -571,7 +571,7 @@ if (!$get_info)
'primary' => 'vote_desc.topic_id',
'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
- array('poll_option_id', 1, ''),
+ array('poll_option_id', VOTE_CONVERTED, ''),
array('topic_id', 'vote_desc.topic_id', ''),
array('vote_user_id', 'vote_voters.vote_user_id', 'phpbb_user_id'),
array('vote_user_ip', 'vote_voters.vote_user_ip', 'decode_ip'),
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php
index 27989f3c60..337a21c11f 100644
--- a/phpBB/language/en/viewtopic.php
+++ b/phpBB/language/en/viewtopic.php
@@ -105,6 +105,7 @@ $lang = array_merge($lang, array(
'VIEW_UNREAD_POST' => 'First unread post',
'VISIT_WEBSITE' => 'WWW',
'VOTE_SUBMITTED' => 'Your vote has been cast.',
+ 'VOTE_CONVERTED' => 'Changing votes is not supported for converted polls.',
));
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index c44d413f60..f99278aece 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -654,13 +654,25 @@ if (!empty($topic_data['poll_start']))
if ($update && $s_can_vote)
{
- if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'])
+
+ if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id))
{
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;start=$start");
meta_refresh(5, $redirect_url);
-
- $message = (!sizeof($voted_id)) ? 'NO_VOTE_OPTION' : 'TOO_MANY_VOTE_OPTIONS';
+ if (!sizeof($voted_id))
+ {
+ $message = 'NO_VOTE_OPTION';
+ }
+ else if (sizeof($voted_id) > $topic_data['poll_max_options'])
+ {
+ $message = 'TOO_MANY_VOTE_OPTIONS';
+ }
+ else
+ {
+ $message = 'VOTE_CONVERTED';
+ }
+
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}