diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 939de4b1ab..461a700c89 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -265,17 +265,21 @@ function get_moderators(&$forum_moderators, $forum_id = false)
}
// User authorisation levels output
-function gen_forum_auth_level($mode, &$forum_id)
+function gen_forum_auth_level($mode, $forum_id)
{
global $SID, $template, $auth, $user;
- $rules = array('post', 'reply', 'edit', 'delete', 'attach');
+ $rules = array(
+ ($auth->acl_get('f_post', $forum_id)) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'],
+ ($auth->acl_get('f_reply', $forum_id)) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'],
+ ($auth->acl_gets('f_edit', 'm_edit', $forum_id)) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'],
+ ($auth->acl_gets('f_delete', 'm_delete', $forum_id)) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'],
+ ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach', $forum_id)) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']
+ );
foreach ($rules as $rule)
{
- $template->assign_block_vars('rules', array(
- 'RULE' => ($auth->acl_get('f_' . $rule, intval($forum_id))) ? $user->lang['RULES_' . strtoupper($rule) . '_CAN'] : $user->lang['RULES_' . strtoupper($rule) . '_CANNOT'])
- );
+ $template->assign_block_vars('rules', array('RULE' => $rule));
}
return;
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index bb820946d0..516f38aa6d 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -105,7 +105,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
{
$active_forum_ary['forum_id'][] = $forum_id;
$active_forum_ary['enable_icons'][] = $row['enable_icons'];
- $active_forum_ary['forum_topics'] += $row['forum_topics'];
+ $active_forum_ary['forum_topics'] += ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
$active_forum_ary['forum_posts'] += $row['forum_posts'];
}
@@ -128,7 +128,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
// Include subforum topic/post counts in parent counts
- $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics'];
+ $forum_rows[$parent_id]['forum_topics'] += ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
// Do not list redirects in LINK Forums as Posts.
if ($row['forum_type'] != FORUM_LINK)
@@ -313,7 +313,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESC' => $row['forum_desc'],
$l_post_click_count => $post_click_count,
- 'TOPICS' => $row['forum_topics'],
+ 'TOPICS' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['forum_topics_real'] : $row['forum_topics'],
'LAST_POST_TIME' => $last_post_time,
'LAST_POSTER' => $last_poster,
'MODERATORS' => $moderators_list,
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index fede697d1e..c44d539716 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -68,7 +68,7 @@ function generate_smilies($mode, $forum_id)
{
$template->assign_block_vars('emoticon', array(
'SMILEY_CODE' => $row['code'],
- 'SMILEY_IMG' => $config['smilies_path'] . '/' . $row['smile_url'],
+ 'SMILEY_IMG' => $phpbb_root_path . $config['smilies_path'] . '/' . $row['smile_url'],
'SMILEY_WIDTH' => $row['smile_width'],
'SMILEY_HEIGHT' => $row['smile_height'],
'SMILEY_DESC' => $row['emoticon'])
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index a33e82e055..9b60b50973 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -501,7 +501,7 @@ function place_pm_into_folder($global_privmsgs_rules, $release = false)
}
}
- if ($full_folder_action != FULL_FOLDER_MOVE)
+ if ($full_folder_action < 0)
{
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
SET folder_id = $dest_folder, new = 0
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 1229055b9d..88b83e4cd3 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -995,60 +995,56 @@ class parse_message extends bbcode_firstpass
}
// Parse Poll
- function parse_poll(&$poll, $poll_data)
+ function parse_poll(&$poll)
{
- global $auth, $forum_id, $user, $config;
+ global $auth, $user, $config;
- // Need a second look at
- return;
- /*
- // Process poll options
- if ($poll_data['poll_option_text'] && (($auth->acl_get('f_poll', $forum_id) && !$poll_data['poll_last_vote']) || $auth->acl_get('m_edit', $forum_id)))
+ $poll_max_options = $poll['poll_max_options'];
+
+ // Parse Poll Option text ;)
+ $tmp_message = $this->message;
+ $this->message = $poll['poll_option_text'];
+ $bbcode_bitfield = $this->bbcode_bitfield;
+
+ $poll['poll_option_text'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
+
+ $this->bbcode_bitfield |= $bbcode_bitfield;
+ $this->message = $tmp_message;
+
+ // Parse Poll Title
+ $tmp_message = $this->message;
+ $this->message = $poll['poll_title'];
+ $bbcode_bitfield = $this->bbcode_bitfield;
+
+ $poll['poll_title'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
+
+ $this->bbcode_bitfield |= $bbcode_bitfield;
+ $this->message = $tmp_message;
+
+ unset($tmp_message);
+
+ $poll['poll_options'] = explode("\n", trim($poll['poll_option_text']));
+ $poll['poll_options_size'] = sizeof($poll['poll_options']);
+
+ if (sizeof($poll['poll_options']) == 1)
{
- $message = $this->message;
- $this->message = $poll_data['poll_option_text'];
-
- if (($result = $this->parse($poll_data['enable_html'], $poll_data['enable_bbcode'], $poll_data['bbcode_uid'], $poll_data['enable_urls'], $poll_data['enable_smilies'], false)) != '')
- {
- $this->warn_msg[] = $result;
- }
-
- $poll_data['poll_option_text'] = $this->message;
- $this->message = $message;
- unset($message);
-
- $poll['poll_options'] = explode("\n", trim($poll_data['poll_option_text']));
- $poll['poll_options_size'] = sizeof($poll['poll_options']);
-
- if (sizeof($poll['poll_options']) == 1)
- {
- $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
- }
- elseif (sizeof($poll['poll_options']) > intval($config['max_poll_options']))
- {
- $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS'];
- }
- elseif (sizeof($poll['poll_options']) < $poll['poll_options_size'])
- {
- $this->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS'];
- }
- elseif ($poll_data['poll_max_options'] > sizeof($poll['poll_options']))
- {
- $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS'];
- }
-
- $poll['poll_title'] = ($poll_data['poll_title']) ? $poll_data['poll_title'] : '';
- $poll['poll_length'] = ($poll_data['poll_length']) ? intval($poll_data['poll_length']) : 0;
-
- if (!$poll['poll_title'] && $poll['poll_options_size'])
- {
- $this->warn_msg[] = $user->lang['NO_POLL_TITLE'];
- }
+ $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
+ }
+ else if ($poll['poll_options_size'] > (int) $config['max_poll_options'])
+ {
+ $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS'];
+ }
+ else if ($poll_max_options > $poll['poll_options_size'])
+ {
+ $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS'];
}
- $poll['poll_start'] = $poll_data['poll_start'];
- $poll['poll_max_options'] = ($poll_data['poll_max_options'] < 1) ? 1 : (($poll_data['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll_data['poll_max_options']);
- */
+ if (!$poll['poll_title'] && $poll['poll_options_size'])
+ {
+ $this->warn_msg[] = $user->lang['NO_POLL_TITLE'];
+ }
+
+ $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']);
}
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 5aa9d52b77..c69328ff5a 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -751,7 +751,7 @@ class user extends session
static $imgs;
global $phpbb_root_path;
- if (empty($imgs[$img . $suffix]) || $width)
+ if (empty($imgs[$img . $suffix]) || $width !== false)
{
if (!isset($this->theme['primary'][$img]) || !$this->theme['primary'][$img])
{
@@ -760,7 +760,7 @@ class user extends session
return $imgs[$img . $suffix];
}
- if (!$width)
+ if ($width === false)
{
list($imgsrc, $height, $width) = explode('*', $this->theme['primary'][$img]);
}
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index b00bb65cfb..6d1b612288 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -153,9 +153,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($user_info['online']) ? $user->img('btn_online', $user->lang['ONLINE']) : $user->img('btn_offline', $user->lang['OFFLINE'])),
'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_PM']),
- 'IP_IMG' => $user->img('btn_ip', $user->lang['VIEW_IP']),
+ 'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']),
'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']),
- 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['REPORTED_MESSAGE']),
+ 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['MESSAGE_REPORTED_MESSAGE']),
'PROFILE_IMG' => $user->img('btn_profile', $user->lang['READ_PROFILE']),
'EMAIL_IMG' => $user->img('btn_email', $user->lang['SEND_EMAIL']),
'QUOTE_IMG' => $user->img('btn_quote', $user->lang['POST_QUOTE_PM']),
@@ -171,7 +171,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'],
'U_REPORT' => ($config['auth_report_pm'] && $auth->acl_get('u_pm_report')) ? "{$phpbb_root_path}report.$phpEx$SID&pm=" . $message_row['msg_id'] : '',
- 'U_IP' => ($auth->acl_get('m_ip') && $message_row['message_reported']) ? "{$phpbb_root_path}mcp.$phpEx?sid=" . $user->session_id . "&mode=pm_details&p=" . $message_row['msg_id'] . '#ip' : '',
+ 'U_INFO' => ($auth->acl_get('m_') && ($message_row['message_reported'] || $message_row['forwarded'])) ? "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'] : '',
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '',
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $author_id,
'U_EMAIL' => $user_info['email'],
@@ -201,7 +201,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
}
}
- if ($_REQUEST['view'] != 'print')
+ if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print')
{
// Message History
if (message_history($msg_id, $user->data['user_id'], $message_row, $folder))
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index 32981c93bd..7beb7cc8c5 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -802,8 +802,9 @@ CREATE TABLE phpbb_topics (
poll_title varchar(255) NOT NULL,
poll_start int(11) DEFAULT '0' NOT NULL,
poll_length int(11) DEFAULT '0' NOT NULL,
- poll_max_options tinyint(4) UNSIGNED NOT NULL DEFAULT '1',
- poll_last_vote int(11),
+ poll_max_options tinyint(4) UNSIGNED DEFAULT '1' NOT NULL,
+ poll_last_vote int(11) UNSIGNED DEFAULT '0',
+ poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (topic_id),
KEY forum_id (forum_id),
KEY forum_id_type (forum_id, topic_type),
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 6a72d8d651..83f0d2f30f 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -333,6 +333,7 @@ $lang += array(
'SORT_BY' => 'Sort by',
'SORT_JOINED' => 'Joined Date',
'SORT_LOCATION' => 'Location',
+ 'SORT_RANK' => 'Rank',
'SORT_TOPIC_TITLE' => 'Topic Title',
'SORT_USERNAME' => 'Username',
'SPLIT_TOPIC' => 'Split Topic',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index c22261b3e0..e6c86acdee 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -136,6 +136,8 @@ $lang += array(
'POLL_OPTIONS' => 'Poll options',
'POLL_OPTIONS_EXPLAIN' => 'Place each option on a new line. You may enter up to %d options',
'POLL_QUESTION' => 'Poll question',
+ 'POLL_VOTE_CHANGE' => 'Allow Vote Change',
+ 'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.',
'POSTED_ATTACHMENTS' => 'Posted attachments',
'POST_ANNOUNCEMENT' => 'Announce',
'POST_DELETED' => 'Your message has been deleted successfully',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 7a90e242cd..6a4ad557ac 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -119,6 +119,7 @@ $lang += array(
'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft.',
'EMAIL_REMIND' => 'This must be the email address you supplied when registering.',
+ 'EMAIL_PM' => 'Email PM',
'EMPTY_DRAFT' => 'You must enter a message to submit your changes',
'EMPTY_DRAFT_TITLE' => 'You must enter a draft title',
'EXPORT_AS_XML' => 'Export as XML',
@@ -168,6 +169,7 @@ $lang += array(
'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folder reached',
'MESSAGE_COLOURS' => 'Message Colours',
'MESSAGE_HISTORY' => 'Message History',
+ 'MESSAGE_REPORTED' => 'Click to view reports',
'MESSAGE_REPORTED_MESSAGE' => 'Reported Message',
'MESSAGE_STORED' => 'The message has been send successfully',
'MINIMUM_KARMA' => 'Minimum User Karma',
@@ -319,6 +321,7 @@ $lang += array(
'VIEW_NEXT_HISTORY' => 'Next PM in history',
'VIEW_NEXT_PM' => 'Next PM',
'VIEW_PM' => 'View Message',
+ 'VIEW_PM_INFO' => 'Message Details',
'VIEW_PM_MESSAGE' => '1 Message',
'VIEW_PM_MESSAGES' => '%d Messages',
'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history',
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 754b286370..6258967418 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -716,7 +716,7 @@ switch ($mode)
// Are we looking at a usergroup? If so, fetch additional info
// and further restrict the user info query
- $sql_from = '';
+ $sql_from = $sql_where = '';
if ($mode == 'group')
{
$sql = 'SELECT *
@@ -783,7 +783,7 @@ switch ($mode)
'AVATAR_IMG' => $avatar_img,
'RANK_IMG' => $rank_img,
- 'U_PM' => ($auth->acl_get('u_sendpm')) ? "ucp.$phpEx$SID&i=pm&mode=compose&g=$group_id" : '',)
+ 'U_PM' => ($auth->acl_get('u_sendpm') && $group_receive_pm && $config['allow_mass_pm']) ? "ucp.$phpEx$SID&i=pm&mode=compose&g=$group_id" : '',)
);
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
@@ -915,18 +915,18 @@ switch ($mode)
'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
'U_FIND_MEMBER' => (!empty($config['load_search']) || $auth->acl_get('a_')) ? "memberlist.$phpEx$SID&mode=searchuser" : '',
- 'U_SORT_USERNAME' => "memberlist.$phpEx$SID&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FROM' => "memberlist.$phpEx$SID&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_JOINED' => "memberlist.$phpEx$SID&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_POSTS' => "memberlist.$phpEx$SID&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_EMAIL' => "memberlist.$phpEx$SID&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ICQ' => "memberlist.$phpEx$SID&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_AIM' => "memberlist.$phpEx$SID&sk=h&sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_MSN' => "memberlist.$phpEx$SID&sk=i&sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_YIM' => "memberlist.$phpEx$SID&sk=j&sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&sk=k&sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_RANK' => "memberlist.$phpEx$SID&sk=l&sd=" . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_USERNAME' => $pagination_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FROM' => $pagination_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_JOINED' => $pagination_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_POSTS' => $pagination_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_EMAIL' => $pagination_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_WEBSITE' => $pagination_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ICQ' => $pagination_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_AIM' => $pagination_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_MSN' => $pagination_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_YIM' => $pagination_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ACTIVE' => $pagination_url . '&sk=k&sd=' . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_RANK' => $pagination_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_MODE_SELECT' => $s_sort_key,
diff --git a/phpBB/posting.php b/phpBB/posting.php
index fed6c55f26..dfe3d099a6 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -138,7 +138,7 @@ if ($sql)
$post_edit_locked = (isset($post_edit_locked)) ? (int) $post_edit_locked : 0;
- $user->setup(array('posting', 'mcp'), $forum_style);
+ $user->setup(array('posting', 'mcp', 'viewtopic'), $forum_style);
if ($forum_password)
{
@@ -154,6 +154,7 @@ if ($sql)
$post_subject = (in_array($mode, array('quote', 'edit', 'delete'))) ? $post_subject : ((isset($topic_title)) ? $topic_title : '');
$topic_time_limit = (isset($topic_time_limit)) ? (($topic_time_limit) ? (int) $topic_time_limit / 86400 : (int) $topic_time_limit) : 0;
+
$poll_length = (isset($poll_length)) ? (($poll_length) ? (int) $poll_length / 86400 : (int) $poll_length) : 0;
$poll_start = (isset($poll_start)) ? (int) $poll_start : 0;
$poll_options = array();
@@ -179,6 +180,7 @@ if ($sql)
$db->sql_freeresult($result);
}
+ $orig_poll_options_size = sizeof($poll_options);
$message_parser = new parse_message();
if (isset($post_text))
@@ -492,7 +494,6 @@ if ($load && $drafts)
if ($submit || $preview || $refresh)
{
$topic_cur_post_id = request_var('topic_cur_post_id', 0);
-
$subject = request_var('subject', '');
if (strcmp($subject, strtoupper($subject)) == 0 && $subject)
@@ -532,19 +533,35 @@ if ($submit || $preview || $refresh)
$status_switch = 1;
}
- if ($poll_delete && (($mode == 'edit' && $poll_options && !$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
+ // Delete Poll
+ if ($poll_delete && $mode == 'edit' && $poll_options &&
+ ((!$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
{
- // Delete Poll
- $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
- WHERE topic_id = $topic_id";
- $db->sql_query($sql);
+ switch (SQL_LAYER)
+ {
+ case 'mysql4':
+ $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
+ break;
+ default:
+ $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
+ }
+
$topic_sql = array(
'poll_title' => '',
'poll_start' => 0,
'poll_length' => 0,
'poll_last_vote' => 0,
- 'poll_max_options' => 0
+ 'poll_max_options' => 0,
+ 'poll_vote_change' => 0
);
$sql = 'UPDATE ' . TOPICS_TABLE . '
@@ -552,7 +569,8 @@ if ($submit || $preview || $refresh)
WHERE topic_id = $topic_id";
$db->sql_query($sql);
- $poll_title = $poll_length = $poll_option_text = $poll_max_options = '';
+ $poll_title = $poll_option_text = '';
+ $poll_vote_change = $poll_max_options = $poll_length = 0;
}
else
{
@@ -560,9 +578,9 @@ if ($submit || $preview || $refresh)
$poll_length = request_var('poll_length', 0);
$poll_option_text = request_var('poll_option_text', '');
$poll_max_options = request_var('poll_max_options', 1);
+ $poll_vote_change = ($auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
}
-
// If replying/quoting and last post id has changed
// give user option to continue submit or return to post
// notify and show user the post made between his request and the final submit
@@ -644,25 +662,41 @@ if ($submit || $preview || $refresh)
$error[] = $user->lang['EMPTY_SUBJECT'];
}
- $poll_data = array(
- 'poll_title' => $poll_title,
- 'poll_length' => $poll_length,
- 'poll_max_options' => $poll_max_options,
- 'poll_option_text' => $poll_option_text,
- 'poll_start' => $poll_start,
- 'poll_last_vote' => (isset($poll_last_vote)) ? $poll_last_vote : 0,
- 'enable_html' => $enable_html,
- 'enable_bbcode' => $enable_bbcode,
- 'bbcode_uid' => $message_parser->bbcode_uid,
- 'enable_urls' => $enable_urls,
- 'enable_smilies' => $enable_smilies
- );
+ $poll_last_vote = (isset($poll_last_vote)) ? $poll_last_vote : 0;
- $poll = array();
- $message_parser->parse_poll($poll, $poll_data);
+ if ($poll_option_text &&
+ ($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
+ && $auth->acl_get('f_poll', $forum_id))
+ {
+ $poll = array(
+ 'poll_title' => $poll_title,
+ 'poll_length' => $poll_length,
+ 'poll_max_options' => $poll_max_options,
+ 'poll_option_text' => $poll_option_text,
+ 'poll_start' => $poll_start,
+ 'poll_last_vote' => $poll_last_vote,
+ 'poll_vote_change' => $poll_vote_change,
+ 'enable_html' => $enable_html,
+ 'enable_bbcode' => $enable_bbcode,
+ 'enable_urls' => $enable_urls,
+ 'enable_smilies' => $enable_smilies,
+ 'img_status' => $img_status
+ );
- $poll_options = isset($poll['poll_options']) ? $poll['poll_options'] : '';
- $poll_title = isset($poll['poll_title']) ? $poll['poll_title'] : '';
+ $message_parser->parse_poll($poll);
+
+ $poll_options = isset($poll['poll_options']) ? $poll['poll_options'] : '';
+ $poll_title = isset($poll['poll_title']) ? $poll['poll_title'] : '';
+
+ if ($poll_last_vote && ($poll['poll_options_size'] < $orig_poll_options_size))
+ {
+ $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS'];
+ }
+ }
+ else
+ {
+ $poll = array();
+ }
// Check topic type
if ($topic_type != POST_NORMAL && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
@@ -836,19 +870,35 @@ if (!sizeof($error) && $preview)
$preview_subject = censor_text($subject);
// Poll Preview
- if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && !$poll_last_vote)) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)) && $poll_title)
+ if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
+ && $auth->acl_get('f_poll', $forum_id))
{
+ $parse_poll = new parse_message($poll_title);
+ $parse_poll->bbcode_uid = $message_parser->bbcode_uid;
+ $parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield;
+
+ $parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
+
$template->assign_vars(array(
- 'S_HAS_POLL_OPTIONS' => (sizeof($poll_options)),
- 'POLL_QUESTION' => $poll_title)
+ 'S_HAS_POLL_OPTIONS'=> (sizeof($poll_options)),
+ 'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
+
+ 'POLL_QUESTION' => $parse_poll->message,
+
+ 'L_POLL_LENGTH' => ($poll_length) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_length + $poll_start)) : '',
+ 'L_MAX_VOTES' => ($poll_max_options == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $poll_max_options))
);
- foreach ($poll_options as $option)
+ $parse_poll->message = implode("\n", $poll_options);
+ $parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
+ $preview_poll_options = explode('
', $parse_poll->message);
+ unset($parse_poll);
+
+ foreach ($preview_poll_options as $option)
{
- $template->assign_block_vars('poll_option', array(
- 'POLL_OPTION_CAPTION' => $option)
- );
+ $template->assign_block_vars('poll_option', array('POLL_OPTION_CAPTION' => $option));
}
+ unset($preview_poll_options);
}
// Attachment Preview
@@ -892,6 +942,20 @@ if (($mode == 'reply' || $mode == 'quote') && !$preview && !$refresh)
$attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
$post_text = $message_parser->message;
+
+if (sizeof($poll_options) && $poll_title)
+{
+ $message_parser->message = $poll_title;
+ $message_parser->bbcode_uid = $bbcode_uid;
+
+ $message_parser->decode_message();
+ $poll_title = $message_parser->message;
+
+ $message_parser->message = implode("\n", $poll_options);
+ $message_parser->decode_message();
+ $poll_options = explode("\n", $message_parser->message);
+}
+
unset($message_parser);
// MAIN POSTING PAGE BEGINS HERE
@@ -1038,26 +1102,23 @@ $template->assign_vars(array(
);
// Poll entry
-if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && !$poll_last_vote)) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)))
+if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
+ && $auth->acl_get('f_poll', $forum_id))
{
$template->assign_vars(array(
'S_SHOW_POLL_BOX' => true,
+ 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id)),
'S_POLL_DELETE' => ($mode == 'edit' && $poll_options && ((!$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
'L_POLL_OPTIONS_EXPLAIN'=> sprintf($user->lang['POLL_OPTIONS_EXPLAIN'], $config['max_poll_options']),
+ 'VOTE_CHANGE_CHECKED' => (isset($poll_vote_change) && $poll_vote_change) ? ' checked="checked"' : '',
'POLL_TITLE' => (isset($poll_title)) ? $poll_title : '',
'POLL_OPTIONS' => (isset($poll_options) && $poll_options) ? implode("\n", $poll_options) : '',
'POLL_MAX_OPTIONS' => (isset($poll_max_options)) ? (int) $poll_max_options : 1,
'POLL_LENGTH' => $poll_length)
);
}
-else if ($mode == 'edit' && $poll_last_vote && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)))
-{
- $template->assign_vars(array(
- 'S_POLL_DELETE' => ($mode == 'edit' && $poll_options && ($auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id))))
- );
-}
// Attachment entry
// Not using acl_gets here, because it is using OR logic
@@ -1371,7 +1432,8 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
'poll_title' => $poll['poll_title'],
'poll_start' => ($poll['poll_start']) ? $poll['poll_start'] : $current_time,
'poll_max_options' => $poll['poll_max_options'],
- 'poll_length' => $poll['poll_length'] * 86400)
+ 'poll_length' => ($poll['poll_length'] * 86400),
+ 'poll_vote_change' => $poll['poll_vote_change'])
);
}
@@ -1406,9 +1468,10 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
'poll_title' => ($poll['poll_options']) ? $poll['poll_title'] : '',
'poll_start' => ($poll['poll_options']) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0,
'poll_max_options' => ($poll['poll_options']) ? $poll['poll_max_options'] : 1,
- 'poll_length' => ($poll['poll_options']) ? $poll['poll_length'] * 86400 : 0,
+ 'poll_length' => ($poll['poll_options']) ? ($poll['poll_length'] * 86400) : 0,
+ 'poll_vote_change' => $poll['poll_vote_change'],
- 'topic_attachment' => ($post_mode == 'edit_topic') ? ((sizeof($data['filename_data']['physical_filename'])) ? 1 : 0) : $data['topic_attachment']
+ 'topic_attachment' => ($post_mode == 'edit_topic') ? ((isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data']['physical_filename'])) ? 1 : 0) : $data['topic_attachment']
);
break;
}
@@ -1561,7 +1624,7 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
{
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '
- WHERE poll_option_id > ' . sizeof($poll['poll_options']) . '
+ WHERE poll_option_id >= ' . sizeof($poll['poll_options']) . '
AND topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
}
diff --git a/phpBB/styles/subSilver/template/posting_poll_body.html b/phpBB/styles/subSilver/template/posting_poll_body.html
index d3073557d5..146d2780b3 100644
--- a/phpBB/styles/subSilver/template/posting_poll_body.html
+++ b/phpBB/styles/subSilver/template/posting_poll_body.html
@@ -7,21 +7,26 @@
{L_ADD_POLL_EXPLAIN} |
- {L_POLL_QUESTION} |
+ {L_POLL_QUESTION}: |
|
- {L_POLL_OPTIONS} {L_POLL_OPTIONS_EXPLAIN} |
+ {L_POLL_OPTIONS}: {L_POLL_OPTIONS_EXPLAIN} |
|
- {L_POLL_MAX_OPTIONS} {L_POLL_MAX_OPTIONS_EXPLAIN} |
+ {L_POLL_MAX_OPTIONS}: {L_POLL_MAX_OPTIONS_EXPLAIN} |
|
{L_POLL_FOR} |
{L_DAYS} {L_POLL_FOR_EXPLAIN} |
+
+
+ {L_POLL_VOTE_CHANGE}: {L_POLL_VOTE_CHANGE_EXPLAIN} |
+ |
+
{L_POLL_DELETE} |
diff --git a/phpBB/styles/subSilver/template/posting_preview.html b/phpBB/styles/subSilver/template/posting_preview.html
index d8270dbd25..813ba21875 100644
--- a/phpBB/styles/subSilver/template/posting_preview.html
+++ b/phpBB/styles/subSilver/template/posting_preview.html
@@ -12,19 +12,31 @@
- {POLL_QUESTION} |
+ {POLL_QUESTION} {L_POLL_LENGTH} |
-
+ |
- |
+
+ {L_MAX_VOTES} |
+
+
+
diff --git a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html
index ba82081e04..5b22975b9b 100644
--- a/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/subSilver/template/ucp_pm_viewmessage.html
@@ -143,7 +143,7 @@
diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html
index 993e887d46..9c383feae7 100644
--- a/phpBB/styles/subSilver/template/viewtopic_body.html
+++ b/phpBB/styles/subSilver/template/viewtopic_body.html
@@ -69,7 +69,13 @@
- checked="checked"/> checked="checked" /> |
+
+
+ checked="checked" />
+
+ checked="checked" />
+
+ |
{poll_option.POLL_OPTION_CAPTION} |
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 589c414bbb..0b5fac444b 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -172,7 +172,7 @@ if ($user->data['user_id'] != ANONYMOUS)
// whereupon we join on the forum_id passed as a parameter ... this
// is done so navigation, forum name, etc. remain consistent with where
// user clicked to view a global topic
-$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, t.topic_replies_real, t.topic_replies, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_flags, f.forum_rules_bbcode_uid, f.forum_rules_bbcode_bitfield' . $extra_fields . '
+$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, t.topic_replies_real, t.topic_replies, t.topic_first_post_id, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, t.poll_vote_change, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_flags, f.forum_rules_bbcode_uid, f.forum_rules_bbcode_bitfield' . $extra_fields . '
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . "
WHERE $join_sql
AND (f.forum_id = t.forum_id
@@ -510,10 +510,12 @@ $template->assign_vars(array(
// Does this topic contain a poll?
if (!empty($poll_start))
{
- $sql = 'SELECT *
- FROM ' . POLL_OPTIONS_TABLE . '
- WHERE topic_id = ' . $topic_id . '
- ORDER BY poll_option_id';
+ $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
+ FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p
+ WHERE o.topic_id = $topic_id
+ AND p.post_id = $topic_first_post_id
+ AND p.topic_id = o.topic_id
+ ORDER BY o.poll_option_id";
$result = $db->sql_query($sql);
$poll_info = array();
@@ -522,7 +524,7 @@ if (!empty($poll_start))
$poll_info[] = $row;
}
$db->sql_freeresult($result);
-
+
$cur_voted_id = array();
if ($user->data['user_id'] != ANONYMOUS)
{
@@ -550,7 +552,7 @@ if (!empty($poll_start))
}
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
- $auth->acl_get('f_votechg', $forum_id)) &&
+ ($auth->acl_get('f_votechg', $forum_id) && $poll_vote_change)) &&
(($poll_length != 0 && $poll_start + $poll_length > time()) || $poll_length == 0) &&
$topic_status != ITEM_LOCKED &&
$forum_status != ITEM_LOCKED) ? true : false;
@@ -632,10 +634,27 @@ if (!empty($poll_start))
$poll_total += $poll_option['poll_option_total'];
}
+ if ($poll_info[0]['bbcode_bitfield'])
+ {
+ include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
+ $poll_bbcode = new bbcode();
+
+ for ($i = 0, $j = sizeof($poll_info); $i < $j; $i++)
+ {
+ $poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
+ $poll_info[$i]['poll_option_text'] = smilie_text($poll_info[$i]['poll_option_text']);
+ $poll_info[$i]['poll_option_text'] = str_replace("\n", '
', censor_text($poll_info[$i]['poll_option_text']));
+ }
+
+ $poll_bbcode->bbcode_second_pass($poll_title, $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
+ $poll_title = smilie_text($poll_title);
+ $poll_title = str_replace("\n", '
', censor_text($poll_title));
+
+ unset($poll_bbcode);
+ }
+
foreach ($poll_info as $poll_option)
{
- $poll_option['poll_option_text'] = censor_text($poll_option['poll_option_text']);
-
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
@@ -650,7 +669,7 @@ if (!empty($poll_start))
}
$template->assign_vars(array(
- 'POLL_QUESTION' => censor_text($poll_title),
+ 'POLL_QUESTION' => $poll_title,
'TOTAL_VOTES' => $poll_total,
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
@@ -667,8 +686,7 @@ if (!empty($poll_start))
'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')
);
- unset($poll_info);
- unset($voted_id);
+ unset($poll_info, $voted_id);
}
// If the user is trying to reach the second half of the topic, fetch it starting from the end
@@ -1243,7 +1261,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_EDIT' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? "posting.$phpEx$SID&mode=edit&f=$forum_id&p=" . $row['post_id'] : '',
'U_QUOTE' => ($auth->acl_get('f_quote', $forum_id)) ? "posting.$phpEx$SID&mode=quote&f=$forum_id&p=" . $row['post_id'] : '',
- 'U_INFO' => ($auth->acl_get('m_', $forum_id)) ? "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'] : '',
+ 'U_INFO' => ($auth->acl_get('m_', $forum_id)) ? "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'] : '',
'U_DELETE' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? "posting.$phpEx$SID&mode=delete&f=$forum_id&p=" . $row['post_id'] : '',
'U_PROFILE' => $user_cache[$poster_id]['profile'],